使用正确的格式在外部网页上显示wordpress内容

时间:2014-04-24 07:42:28

标签: php wordpress

我在wordpress中创建了一个通过post_name检索页面的函数,该函数工作正常,但是当我在外部网站上调用该函数并显示页面/帖子内容格式不正确时。

以下是我展示它的方式:

$page = get_page_by_post_name($_GET["id"], OBJECT, 'page');
query_posts('p='.$page->ID.'');
echo '<div id="page-title">'.$page->post_title.'</div>';
echo $page->post_content;

所以我在wordpress编辑器中格式化文本和图像,然后当它们显示时,它只是一大块文本。任何想法?

以下是我在外部页面上的CSS:

html,body {
    margin:0;
    padding:0;
    overflow-x:hidden;
    font-family:Arial;
    height: 100%;
}
h1, h2, h3, h4, h5, h6 {
    clear: both;
    font-weight: 700;
    margin: 36px 0 12px;
}
h1 {
    font-size: 26px;
    line-height: 1.3846153846;
}
h2 {
    font-size: 24px;
    line-height: 1;
}
h3 {
    font-size: 22px;
    line-height: 1.0909090909;
}
h4 {
    font-size: 20px;
    line-height: 1.2;
}
h5 {
    font-size: 18px;
    line-height: 1.3333333333;
}
h6 {
    font-size: 16px;
    line-height: 1.5;
}
h1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child {
    margin-top: 0;
}
p {
    margin: 0 0 24px;
}

1 个答案:

答案 0 :(得分:0)

您必须为外部网页编写css代码以便为内容设置样式。在wordpress中也没有默认样式。主题css文件将具有此

的所有样式
相关问题