Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Wordpress主页上为已装箱的内容添加节标题_Php_Html_Css_Wordpress - Fatal编程技术网

Php 如何在Wordpress主页上为已装箱的内容添加节标题

Php 如何在Wordpress主页上为已装箱的内容添加节标题,php,html,css,wordpress,Php,Html,Css,Wordpress,我正在重新开发我的页面Thoughtforce.org,我喜欢它在主要内容上写着“最新帖子”,我正试图在Wordpress Twenty16主题上复制它。看起来好像他们添加了一个标签来做这件事,但我不确定,我已经搜索了几个小时。下面是标签的外观 <div id="main" class="site-main boxed group"> <div id="primary" class="content-area boxed"> <

我正在重新开发我的页面Thoughtforce.org,我喜欢它在主要内容上写着“最新帖子”,我正试图在Wordpress Twenty16主题上复制它。看起来好像他们添加了一个标签来做这件事,但我不确定,我已经搜索了几个小时。下面是标签的外观

<div id="main" class="site-main boxed group">
<div id="primary" class="content-area boxed">
                    <h3 class="section-title"><span>Latest Posts</span></h3>


    <div id="content" class="site-content group one-column" role="main"                 

<article id="post-455" class="boxed post-455 post type-post status-publish format-standard has-post-thumbnail hentry category-sociology">
            <a href="http://www.thoughtforce.org/de-facto-vs-de-jure/" title="De Facto vs. De Jure (And Their Relationship to Segregation)" class="home-thumb boxed">
        <img width="435" height="247" src="http://www.thoughtforce.org/wp-content/uploads/2017/03/waiting-room-435x247.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt=""> 
最后,该区域的216th代码如下所示:

    <div id="content" class="site-content">

    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">




<article id="post-1" class="post-1 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized">
    <header class="entry-header">
编辑添加代码:

/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 */

get_header(); ?>

    <div id="primary" class="content-area boxed">
        <?php upright_breadcrumb(); ?>

        <h3 class="section-title"><span>
                <?php
                if ( is_category() ) {
                    printf( __( 'Category: %s', 'upright' ), '<span>' . single_cat_title( '', false ) . '</span>' );

                } elseif ( is_tag() ) {
                    printf( __( 'Tag: %s', 'upright' ), '<span>' . single_tag_title( '', false ) . '</span>' );

                } elseif ( is_author() ) {
                    /* Queue the first post, that way we know
                     * what author we're dealing with (if that is the case).
                    */
                    the_post();
                    printf( __( 'Author: %s', 'upright' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
                    /* Since we called the_post() above, we need to
                     * rewind the loop back to the beginning that way
                     * we can run the loop properly, in full.
                     */
                    rewind_posts();

                } elseif ( is_day() ) {
                    printf( __( 'Daily Archives: %s', 'upright' ), '<span>' . get_the_date() . '</span>' );

                } elseif ( is_month() ) {
                    printf( __( 'Archives: %s', 'upright' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );

                } elseif ( is_year() ) {
                    printf( __( 'Yearly Archives: %s', 'upright' ), '<span>' . get_the_date( 'Y' ) . '</span>' );

                } else {
                    _e( 'Archives', 'upright' );

                }
                ?>
            </span></h3>
/**
*主模板文件。
*
*这是WordPress主题中最通用的模板文件
*以及主题所需的两个文件之一(另一个是style.css)。
*它用于在没有更具体的内容与查询匹配时显示页面。
*例如,当不存在home.php文件时,它会将主页放在一起。
*了解更多信息:http://codex.wordpress.org/Template_Hierarchy
*
*/
获取_头();?>

您好,我认为您应该使用
.page title
而不是
#main

.page-title, #reply-title {
    background-color: #dc2834;
    color: #fff;
    font-family: "Raleway",Arial,Helvetica,sans-serif;
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 30px;
    margin-left: -35px;
    padding: 2px 0 1px 35px;
    position: relative;
}
.page-title a {
    color: #fff;
}
.page-title::before, #reply-title::before {
    border-bottom: 5px solid transparent;
    border-right: 5px solid #000;
    border-top: 5px solid transparent;
    bottom: -5px;
    content: "";
    display: block;
    height: 0;
    left: 0;
    position: absolute;
    width: 0;
}
.page-title::after, #reply-title::after {
    background: #dc2834 none repeat scroll 0 0;
    bottom: 0;
    content: "";
    display: block;
    height: 5px;
    left: 0;
    position: absolute;
    width: 5px;
    z-index: 1;
}
.page-title, .page-title a, .page-title::after {  background-color: #000000;}
在index.php文件中

<main id="main" class="site-main" role="main">

请添加以下代码

<h1 class="page-title">Latest Posts</h1>
最新帖子

它工作得很好。请参见

您发布的html脚本的文件名是什么?content-page.php或content.phpI发布了两个html脚本。第一个是我当前的主题,我通过在Chrome中查看页面源代码来获取内容。我查看了这两个文件夹,但都没有。它似乎包含在archive.php中。我将在我的文章末尾添加它似乎包含的代码。添加条件,如
elseif(is_homepage()| | is_front_page()){
您是否在模板中显示了帖子?我不确定是否理解您的意思。我可以将条件添加到代码中。请您尝试进一步解释一下,好吗?似乎没有。页面标题是2616年的一个类。我执行了“Ctrl F”需要验证的网站页面的源代码。如果需要,我可以发布更多的代码。同时,我将尝试使用您的代码来解决问题。是的,您发布的代码似乎不起作用。我尝试使用#main with it、#primary和.entry-header。您将在哪个页面中实现此样式?它是吗在分类文章列表页面上运行良好,请参见下面的链接。我正在尝试在我的博客主页上实现该样式。它是216模板的主页。我希望显示最新的文章,而不是静态的首页,我希望最新的文章有一个标题为“最新文章”就像你在截图中所做的那样。您好,上面的样式已经足够了,请在index.php文件中添加一个小代码,以包含这篇最新的文章标题。我现在正在编辑我的答案
<main id="main" class="site-main" role="main">
<h1 class="page-title">Latest Posts</h1>