我是WordPress主题开发的新手,我有以下问题:
我有这个静态页面:http://lnx.asper-eritrea.com/lassociazione/
这是我的page.php文件的代码,它呈现前一个静态页面:
<?php
/**
* The Template for displaying a single page
*/
get_header();
?>
<!-- Contenuti (griglia) -->
<div class="container">
<!-- Lead presentazione -->
<section id="presentazione">
<div class="row">
<div class="col-sm-12">
<!--<h1 class="text-center"><small>Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</small></h1>-->
<h1 class="text-center title">Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</h1>
<p class="lead text-center">
Association in Defense of the Human Rights of the Eritrean People
</p>
</div><!-- /.col-sm-12 -->
</div><!-- /.row -->
</section><!-- /section presentazione -->
<div id="main-content" class="main-content">
<!--
<?php
if (is_front_page() && twentyfourteen_has_featured_posts()) {
// Include the featured content template.
get_template_part('featured-content');
}
?>
-->
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
// Start the Loop.
while (have_posts()) : the_post();
// Include the page content template.
get_template_part('content', 'page');
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) {
comments_template();
}
endwhile;
?>
-->
</div><!-- #content -->
</div><!-- #primary -->
<!--<?php get_sidebar('content'); ?>-->
</div><!-- #main-content -->
<?php get_footer(); ?>
可以看到,在浏览器中打开前一个链接的页面标题下还显示了作者和日期。
我怎么做才能不显示这些信息?我可以做到这一点,从WordPress管理面板(我找不到它)或我做的代码到我的页面。php文件?
编辑1:这是我的主题内的content.php文件的代码:
<?php
/**
* The default template for displaying content
*
* Used for both single and index/archive/search.
*
* @package WordPress
* @subpackage AsperTheme
* @since AsperTheme 1.0
*/
?>
<!-- Create a div with a unique ID thanks to the_ID() and semantic classes with post_class()
the_ID(): Print the numeric ID of the current post
post_class(): Print out and add various post-related classes to the div tag
-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>"
title="<?php printf(__('Permalink to %s', 'your-theme'), the_title_attribute('echo=0')); ?>"
rel="bookmark"><?php the_title(); ?>
</a>
</h3>
<div class="entry-meta">
<span class="meta-prep meta-prep-author"><?php _e('By ', 'your-theme'); ?></span>
<span class="author vcard">
<a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>"
title="<?php printf(__('View all posts by %s', 'your-theme'), $authordata -> display_name); ?>"><?php the_author(); ?>
</a>
</span>
<span class="meta-sep"> | </span>
<span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
<span class="entry-date">
<abbr class="published" title="<?php the_time('Y-m-d'TH:i:sO') ?>"><?php the_time(get_option('date_format')); ?></abbr>
</span>
<?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class='"meta-sep'">|</span>'n't't't't't't<span class='"edit-link'">", "</span>'n't't't't't" ) ?>
</div> <!-- .entry-meta -->
</header>
<div class="entry-content">
<?php the_content(__('Continue reading <span class="meta-nav">»</span>', 'your-theme')); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
</div> <!-- .entry-content -->
<div class="entry-utility">
<span class="cat-links">
<span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e('Posted in ', 'your-theme'); ?></span>
<?php echo get_the_category_list(', '); ?>
</span>
<span class="meta-sep"> | </span>
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>'n't't't't't't<span class='"meta-sep'">|</span>'n" ) ?>
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
<?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class='"meta-sep'">|</span>'n't't't't't't<span class='"edit-link'">", "</span>'n't't't't't'n" ) ?>
</div> <!-- #entry-utility -->
</article> <!-- #post-<?php the_ID(); ?> -->
Tnx
Andrea
是否有任何content-page.php在您的主题目录?回复我
在Netbeans中添加您的项目,并在下面代码附近右键打开mypage.php
get_template_part('content', 'page');
查找加载帖子内容的函数要么修改content.php,要么使用http请求uri和自定义post_type, wp-query和the_content, the_title修改你的模板。
使用if条件来检查下面的页面或帖子是否有标签。
if(!is_page( 16 )){
?><header>
//
</header><?php
}
进入位于wp-content/themes/AsperTheme/assets/css/的still -custom.css文件,修改
.entry-meta {
font-size: 15px;
}
.entry-meta {
display: none;
}
Andrea
下面的代码应该可以完成这项工作。get_template_部分就是它发挥作用的地方。或者你可以从wp代码中编辑这个函数,但我不建议这样做。
<?php if ( have_posts() ) : ?>
<ul class="articles clearfix">
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
printf('<li id="post-%2$s" class="article %1$s"> ',implode(' ', get_post_class()), get_the_ID() );
get_template_part( 'template/content', 'brief' );
echo '</li>';
wp_reset_postdata();
endwhile;
?>
</ul>
<?php else : ?>
<?php get_template_part( 'template/content', 'none' ); ?>
<?php endif; ?>