【详解WordPress中调用评论模板和循环输出评论的PHP函数】教程文章相关的互联网学习教程文章

php – WordPress只在for循环中回显一次【代码】

所以我试图只打印一些标签,每个循环有四个标签. 所以我总是试图循环并在每个标签上打印一次标签. 第二步是每个循环打印四个标签. 为了更好地解释这里有一些图片. 我想要什么 – http://i.imgur.com/LPbqd53.png它目前是什么 – http://i.imgur.com/WqNrgBc.png 这是我的代码<div class="wpt_test fill_form"><div class="answers"><div class="content"><form<?php foreach ($formAttributes as $key => $value):?><?php echo $k...

php – 在WordPress中为类别循环添加偏移量【代码】

在WordPress主题的category.php中,您有以下循环:if ( have_posts() ) : while ( have_posts() ) : the_post(); // output posts endwhile; endif;你如何输出这个完全相同的循环,但有一个偏移量?我发现你可以通过做一个改变循环query_posts('offset=4');但是这会重置整个循环并且偏移量会起作用,但会显示每个类别的所有帖子,所以我得到的结果是query_posts完全重置了循环并且仅使用您添加的过滤器来完成.有没有办法告诉循环: “...

php – WordPress后循环增量值【代码】

我有一个循环显示每个循环的列表项(对于滑块),如下所示:<?php while (have_posts()) : the_post(); ?> <li data-target="#myCarousel" data-slide-to="0"<?php if( $wp_query->current_post == 0 && !is_paged() ) { ?> class="active"<?php } else { ?><?php } ?>></li> <?php endwhile; ?>但是,对于它生成的每个列表项,我需要将data-slide-to的值增加1.例如,如果循环有3个帖子,最终结果如下所示:<li data-target="#myCarousel"...

php – wordpress get_post_meta无法循环工作【代码】

我试图在自定义字段“价格”订购的页面上发布帖子我已经完成了订购,但现在我无法得到’价格’的价值回应. get_post_meta不提供任何输出.这是代码:$args=array( 'meta_key'=>'price', 'post_type' => 'page','orderby'=>'meta_value_num','post_status' => 'publish','posts_per_page' => -1,'caller_get_posts'=> 1); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) {$count=0;while ($count...

php – 如何在自定义WordPress循环中隐藏过去的帖子并显示即将发布的X个帖子?【代码】

我正在尝试在Wordpress中显示日期等于或大于今天的帖子列表 – 目的是列出即将发生的事件. 这是我现在的代码:// Get the current date$current_date = date('M d, Y');$current_date = strtotime( $current_date );// Get the event date$post_date = get_the_time('M d, Y');$post_date = strtotime( $post_date );query_posts(array('category_name' => 'events','meta_query' => array(array('key' => $post_date,'value'=> $c...

php – WordPress,如果没有来自循环的结果,则不显示标题【代码】

我正在使用WP_Query在wordpress中循环自定义帖子类型.我的循环看起来像这样:<div class="bigRedStrip"><h2>Available Now!</h2> </div><ul><?php $loop = new WP_Query( array( 'post_type' => 'films', 'post_child' => 0, 'posts_per_page' => 8,'orderby' => 'date', 'order' => 'ASC', 'film-categories' => 'blu-ray' ) ); ?><?php while ( $loop->have_posts() ) : $loop->the_post(); ?><li>loop stuff here</li><?php end...

wordpress – Nginx’重写或内部重定向循环,同时内部重定向’导致500【代码】

我对Raspbian喘息的nginx 1.2.1-2.2有点问题.我认为它是在我更改了我的sites-available / default文件中的索引之后开始的.以下是相关文件:nginx.conf user www-data; worker_processes 4; pid /var/run/nginx.pid;events {worker_connections 768;# multi_accept on; }http {### Basic Settings##sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_timeout 65;types_hash_max_size 2048;index index.html index.htm index.php;...

通过Varnish / Apache在WordPress上使用Nginx SSL终止重定向循环【代码】

我有一个设置,其中Apache在端口80上的Varnish 4后面监听端口8080,但是我的客户端需要ssl在网站上工作,所以我使用this guide在端口443上设置Nginx用于SSL终止. 一切都在http上工作正常,但在尝试在https上加载网站时,网站所需的脚本将无法加载,因此我决定更改设置中的网站网址>一般到https网址,保存更改后,我在Chrome中遇到重定向循环错误. 我无法访问该网站的wordpress仪表板来更改网址,所以我必须通过phpmyadmin这样做.但是现在当通...