您可以使用一组数组来保存自定义标题和摘录,这些标题和摘录被键入到帖子ID中。在本例中,11、22、33、44、55、66、77、88和99是示例帖子ID。
$slides = array(
11 => array(
\'title\' => \'Custom title 1\',
\'excerpt\' => \'Custom excerpt 1\',
),
22 => array(
\'title\' => \'Custom title 2\',
\'excerpt\' => \'Custom excerpt 2\',
),
33 => array(
\'title\' => \'Custom title 3\',
\'excerpt\' => \'Custom excerpt 3\',
),
44 => array(
\'title\' => \'Custom title 4\',
\'excerpt\' => \'Custom excerpt 4\',
),
55 => array(
\'title\' => \'Custom title 5\',
\'excerpt\' => \'Custom excerpt 5\',
),
66 => array(
\'title\' => \'Custom title 6\',
\'excerpt\' => \'Custom excerpt 6\',
),
77 => array(
\'title\' => \'Custom title 7\',
\'excerpt\' => \'Custom excerpt 7\',
),
88 => array(
\'title\' => \'Custom title 8\',
\'excerpt\' => \'Custom excerpt 8\',
),
99 => array(
\'title\' => \'Custom title 9\',
\'excerpt\' => \'Custom excerpt 9\',
),
);
而不是使用
get_the_title()
使用
$slides[$post->ID][\'title\']
.
而不是
the_excerpt()
使用
echo $slides[$post->ID][\'excerpt\']
.