php - 显示自定义帖子类型标题的列表

标签 php javascript jquery ajax wordpress

我正在使用以下代码显示自定义帖子类型的列表:

    <!-- List post types -->
    <?php $args = array(
        'post_type'=>'artworks_post',
        'title_li'=> __('')
    );
    wp_list_pages( $args ); 
    ?> 

问题是我无法控制该列表,是否有其他方法来显示自定义帖子类型标题列表,我可以控制它如何进行标记?

最佳答案

使用常规的 ol' WP_Query()

// The Query
$the_query = new WP_Query( 'post_type=artworks_post' );

// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
    echo '<a rel="' .the_permalink(). '" href="' .the_permalink(). ' ">'. the_title() .'</a>';
endwhile;

// Reset Post Data
wp_reset_postdata();

关于php - 显示自定义帖子类型标题的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12940070/

相关文章:

javascript - 将图像从数据库对齐到 html 页面

javascript - 使用 Jquery 抓取 url

javascript - 在 mvc 中回发后自动完成不起作用

javascript - 在点击事件中显示日历

php - 插入... Twitter API 的位置

php - mssql_connect 从 PHP 5.3 开始不再工作

php - 从页面 facebook api graph 获取信息

javascript - Piwik - 如何跟踪点击事件?

用于隐藏 html 列的 Javascript 语法

javascript - 从变量重新加载数据表