2012-01-25 3 views
0

Я установил для использования галерею форматов и видео в дополнение к стандарту. Я редактирую loop-single.php, чтобы дать ему разные макеты для каждого формата сообщения, но я должен включить get_template_part для каждого формата сообщения.Wordpress: Post Format single-loop.php using get_template_part

Это то, что у меня есть:

<?php 
/** 
* The loop that displays a single post. 
* 
* The loop displays the posts and the post content. See 
* http://codex.wordpress.org/The_Loop to understand it and 
* http://codex.wordpress.org/Template_Tags to understand 
* the tags used in it. 
* 
* This can be overridden in child themes with loop-single.php. 
* 
* @package WordPress 
* @subpackage Twenty_Ten 
* @since Twenty Ten 1.2 
*/ 
?> 

<?php if (have_posts()) while (have_posts()) : the_post(); ?> 


<?php 

    if (has_post_format('gallery')) { 
     // code to display the gallery format post here 

     get_template_part('news' 'gallery'); // News Gallery Template (news-gallery.php) 

    } else if (has_post_format('video')) { 
     // stuff to display the video format post here 

     get_template_part('news' 'video'); // News Gallery Template (news-video.php) 

    }else { 
     // code to display the normal format post here 

     get_template_part('news' 'standard'); // News Gallery Template (news-standard.php) 

    } 

    <?php endwhile; // end of the loop. ?> 


?> 

Это приходит с ошибкой, когда я тестирование:

Анализировать ошибка: синтаксическая ошибка, неожиданный T_CONSTANT_ENCAPSED_STRING в/главная/judddev/public_html/pitch/wp-content/themes/pitch/loop-single.php on line 26

Любая помощь была бы принята с благодарностью.

+0

Что такое линия 26? – Toto

+0

get_template_part ('news' 'gallery'); // News Gallery Template (news-gallery.php) Возможно – Guy

ответ

1

Добавить запятую между

get_template_part ('Новости', 'галерея');

+0

Ошибка появления ошибки: синтаксическая ошибка, неожиданная '<' в /public_html/pitch/wp-content/themes/pitch/loop-single.php в строке 40 , который является Guy

+0

что на линии 40 ?? –

+0

Guy

0

Добавить запятую:

get_template_part('news', 'gallery'); 
       here ___^ 

, а также в Прочие принадлежности вызывает к get_template_part

+0

Появилась новая ошибка Ошибка анализа: синтаксическая ошибка, неожиданный '<' в /public_html/pitch/wp-content/themes/pitch/loop-single.php в строке 40, который является Guy

0
<?php 
/** 
* The loop that displays a single post. 
* 
* The loop displays the posts and the post content. See 
* http://codex.wordpress.org/The_Loop to understand it and 
* http://codex.wordpress.org/Template_Tags to understand 
* the tags used in it. 
* 
* This can be overridden in child themes with loop-single.php. 
* 
* @package WordPress 
* @subpackage Twenty_Ten 
* @since Twenty Ten 1.2 
*/ 
?> 

<?php if (have_posts()) while (have_posts()) : the_post(); ?> 


<?php 

    if (has_post_format('gallery')) { 
     // code to display the gallery format post here 

     get_template_part('news', 'gallery'); // News Gallery Template (news-gallery.php) 

    } else if (has_post_format('video')) { 
     // stuff to display the video format post here 

     get_template_part('news', 'video'); // News Gallery Template (news-video.php) 

    }else { 
     // code to display the normal format post here 

     get_template_part('news', 'standard'); // News Gallery Template (news-standard.php) 

    } 

    ?> 

    <?php endwhile; ?> 

Просто необходимо, чтобы переключить их вокруг от этого:

<?php endwhile; ?> 


    ?> 

к этому

?> 

    <?php endwhile; ?> 
Смежные вопросы