2013-07-30 45 views
0

我希望你可以帮我这个难题...WordPress的类别邮册插件定制

我想定制Wordpress Category Post List plugin以便它列出了简码的帖子标题下方的职位类别。

<a class="wp-cpl-info" href="<?php echo get_permalink($post->ID); ?>" title="<?php echo __('Permalink to: ', $trans) . $post->post_title; ?>"> 
<h2><?php echo get_the_title($post->ID); ?></h2> 
<span class="cross">X</span> 
<span class="details"><?php $categories = get_categories($args); ?></span> 
</a> 

我试图找到WordPress的PHP函数,飞到哪里,当前的代码坐在(这只是一个猜测)。插件输出代码的其余部分是什么是可能的指示......

这段代码的
<?php if($op['show_date'] == 'true' || $op['show_author'] == 'true' || $op['show_comments'] == 'true') : ?> 
<div class="wp-cpl-sc-meta"> 
    <p> 
     <?php if($op['show_date'] == 'true') : ?> 
     <span class="wp-cpl-sc-date"><?php echo __('Posted on ', $trans) . date('M jS, Y', strtotime($post->post_date)) . ' '; ?></span> 
     <?php endif; ?> 
     <?php if($op['show_author'] == 'true') : ?> 
     <span class="wp-cpl-sc-author"><?php echo __(' - By ', $trans) . '<a href="' . get_the_author_meta('user_url', $post->post_author) . '">' . get_the_author_meta('display_name', $post->post_author) . '</a> '; ?></span> 
     <?php endif; ?> 
     <?php if($op['show_comments'] == 'true') : ?> 
     <span class="wp-cpl-sc-comment"><?php echo ' - <a href="' . get_comments_link($post->ID) . '">' . $post->comment_count . ' ' . __ngettext('Comment', 'Comments', $post->comment_count, $trans) . '</a>' ?></span> 
     <?php endif; ?> 
    </p> 
</div> 
<?php endif; ?> 
<?php if($op['show_excerpt'] == 'true') : ?> 
<div class="wp-cpl-sc-entry"> 
    <p> 
     <?php echo (('true' == $op['optional_excerpt'] && $post->post_excerpt != '')? $post->post_excerpt : itgdb_wp_cpl_loader::shorten_string($post->post_content, $op['excerpt_length'])); ?> 
    </p> 
    <?php if('' != $op['read_more']) : ?> 
    <p class="wp-cpl-sc-readmore"> 
     <a href="<?php echo get_permalink($post->ID); ?>"><?php echo $op['read_more']; ?></a> 
    </p> 
    <?php endif; ?> 
</div> 

所有属于wp_cpl_output_gen.php代码中包含了插件文件夹。

希望这一切都有道理!基本上我创建了一些看起来像this的东西,所以我需要能够显示类别。

谢谢堆!

凯瑟琳

+0

你确定发布了这个例子的写入url吗?我在页面上看不到任何东西,看起来像你要求的 – user20232359723568423357842364

+0

欢迎来到Stack Overflow!您不需要在帖子中添加签名 - 您的用户卡会自动添加。阅读[帮助](http://stackoverflow.com/help/behavior)了解更多详情。 – Artemix

+0

谢谢@Artemix。本质上,我只需要调用类别的WP代码片段 - 以与发布标题,作者或日期相同的方式 像这样但是对于类别: <?php回声__('张贴',$ trans)。 date('M jS,Y',strtotime($ post-> post_date))。 ''; ?> user2633964

回答

0

我想通了,和遗憾,如果这个问题被卷绕,我不知道正是我一直在寻找,直到我恍然大悟......

基本上我所需要的类相当于:

<?php echo get_the_title($post->ID); ?> 

,因为它原来这出并不复杂 - 看http://codex.wordpress.org/Function_Reference/get_the_category参考 - 并成为:

<?php echo get_the_category($post->ID); ?> 

谢谢你们!