• Код content.php:

    global $post;
    theme_post_wrapper(
    array(
    'id' => theme_get_post_id(),
    'class' => theme_get_post_class(),
    'thumbnail' => theme_get_post_thumbnail(),
    'title' => '<a href="' . get_permalink( $post->ID ) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>',
    'heading' => theme_get_option('theme_'.(is_single()?'single':'posts').'_article_title_tag'),
    'before' => theme_get_metadata_icons( 'date,author,edit', 'header' ),
    'content' => '<p></p>' . theme_get_excerpt() . '<center><img src="' . get_post_meta($post->ID, 'wpcf-3', true) . '"></center>' . do_shortcode('[ratings]') . ' ',
    
    'after' => theme_get_metadata_icons( 'category,tag,comments', 'footer' )
    )
    );

    Как вставить в контент(‘content’ =>) вот этот php код:

    <?php $image = get_post_meta($post->ID, 'wpcf-3', true);
    if ($image) {
    ?>
    <?php echo $image; ?> выводится содержимое произвольного поля.
    <?php } else { ?>
    Выводится если произвольное поле пустое.
    <?php } ?>

    т.е. мне нужно вот этот код:<center><img src="' . get_post_meta($post->ID, 'wpcf-3', true) . '"></center>

    заменить на этот: `<?php $image = get_post_meta($post->ID, ‘wpcf-3’, true);
    if ($image) {
    ?>
    <center><img src=»<?php echo $image; ?>»></center>
    <?php } else { ?>
    <?php } ?>`

    Я пытался писать его по разному но все время крошится тема. Помогите пожалуйста.

  • Тема «Тема, content.php. Как вставить php?» закрыта для новых ответов.