WordPress:获取帖子时出错

时间:2015-10-20 19:40:20

标签: php wordpress wordpress-theming

我在这样的主页中提取帖子

#include <opencv2\opencv.hpp>
#include <vector>
using namespace std;
using namespace cv;

Mat1b getOctagon(int M)
{
    // M positive and multiple of 3
    CV_Assert((M > 0) && ((M % 3) == 0));

    int k = M / 3;
    int rows = M*2 + 1;
    int cols = M*2 + 1;
    Point c(M, M);

    Mat1b strel(rows, cols, uchar(0));

    // Octagon vertices

    //       0-1
    //      /   \
    //     7     2
    //     |  c  |
    //     6     3
    //      \   /
    //       5-4    


    vector<Point> vertices(8);
    vertices[0].x = c.x - k;
    vertices[0].y = 0;
    vertices[1].x = c.x + k;
    vertices[1].y = 0;

    vertices[2].x = cols-1;
    vertices[2].y = c.y - k;
    vertices[3].x = cols-1;
    vertices[3].y = c.y + k;

    vertices[4].x = c.x + k;
    vertices[4].y = rows-1;
    vertices[5].x = c.x - k;
    vertices[5].y = rows-1;

    vertices[6].x = 0;
    vertices[6].y = c.y + k;
    vertices[7].x = 0;
    vertices[7].y = c.y - k;

    fillConvexPoly(strel, vertices, Scalar(1));

    return strel;

}


int main()
{
    Mat1b kernel = getOctagon(3);

    //morphologyEx(src, dst, MORPH_ERODE, kernel);

    return 0;
}

它会打印帖子,但也会在帖子之前打印此消息:

    <?php
        if ( have_posts() ) :
            // Start the Loop.
            while ( have_posts() ) : the_post();

            get_template_part( 'content', get_post_format() );
            endwhile;                
            twentyfourteen_paging_nav();

        else :
            get_template_part( 'content', 'none' );

        endif;
    ?>

<?php // get_sidebar( 'content' ); ?>

请参阅附件截图,了解帖子enter image description here

的输出

1 个答案:

答案 0 :(得分:1)

了解如何搜索主题文件夹并搜索有问题的代码。如果你不需要它删除它,如果你确实需要它使用正确的PHP。

$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){?>

‘ . ‘Read More’.’ ‘; ?>

问题是它是将代码打印为文本,因为它没有使用php开始标记