简体   繁体   English

使用childthemes时如何在php中添加page_id?

[英]How to add a page_id in a php, when using childthemes?

I need to add various content, including paragraphs to a wordpress-page, for a client. 我需要为客户添加各种内容,包括在WordPress页面上的段落。 I am working through Wordpress/childthemes. 我正在通过Wordpress / childthemes工作。 For some wierd reason, the page I've been handed has no entry through the page-panel in Wordpress, nor does it have a page-id through which I can identitfy, so that I can edit it through functions.php or alike - all i have is a demo page. 出于某种奇怪的原因,我处理过的页面没有通过Wordpress中的页面面板进行输入,也没有可以识别的页面ID,因此可以通过functions.php或类似方式对其进行编辑-我所拥有的只是一个演示页面。 I need to place images and paragraphs. 我需要放置图像和段落。

  <html lang="en-US" class="js"><head>
    <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="pingback" href="http://danwise.democrunch.dk/xmlrpc.php">

    <script type="text/javascript">
        document.documentElement.className = 'js';
    </script>

I expect to find the page_id so that I can add HTML-content through a php-page in the childtheme 我希望找到page_id,以便我可以通过childtheme中的php-page添加HTML内容

You can add the standard class names (including the page IDs) by using WordPress's body_class() function. 您可以使用WordPress的body_class()函数添加标准类名(包括页面ID)。 It would look like this: 它看起来像这样:

<body <?php body_class(); ?>>

And output something like this: 并输出如下内容:

<body class="page page-id-2 page-parent page-template-default logged-in">

You can read more about this in the WordPress docs . 您可以在WordPress文档中阅读有关此内容的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM