English 中文(简体)
Wordpress / PHP - 如何显示页面描述
原标题:Wordpress / PHP - How to show a page description

我新来用 wordpress 进行模板编辑, 我正试图获取页面描述, 以显示在我的网站上, 但它没有出现。 URL Im 试图显示描述的 URL 是在这里 :

http://fourwallsla.com/cortion/the-neighborhood/east-side/

我将页面描述的截图附加到 wordpress 中。 它似乎正在使用归档模板( 为什么没有使用页面模板? ) 。

以下是归档模板的一些代码 :

<div class="main">
<?php if (have_posts()) : $first = true; ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
      <h1><?php single_cat_title(); ?></h1>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
      <h1><?php single_tag_title(); ?></h1>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
      <h1><?php echo get_the_time( F jS, Y ); ?></h1>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
      <h1><?php echo get_the_time( F, Y ); ?></h1>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
      <h1><?php echo get_the_time( Y ); ?></h1>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
      <h1><?php _e(  Author Archive ,  gray_white_black  ); ?></h1>
    <?php /* If this is a paged archive */ } elseif (isset($_GET[ paged ]) && !empty($_GET[ paged ])) { ?>
      <h1><?php _e(  Blog Archives ,  gray_white_black  ); ?></h1>
    <?php } ?>

    <ul class="post-list">
    <?php while (have_posts()) : the_post();

上面的代码中, 栏号 () 适当时指的是页面所显示的类别中家庭列表的内容。 但是, 我如何获得页面本身的栏号? 屏幕截图中显示的页号? 谢谢 。

""https://i.sstatic.net/HJy1o.png" alt="此处的内置图像描述"/ >

最佳回答

It is using the archive.php template because you are retrieving all posts within the category - In The Neighborhood & East Side . If you want it to use the default page.php you would have to publish a page in Wordress. To print the description ("Test Description") or the content of the post, add <?php the_content(); ?> or <?php the_excerpt(); ?>after:

<?php while (have_posts()) : the_post();
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签