certain category posts on a certain page
-
How do I show certain category posts on a certain page?
-
Go to Dashboard>Appearance>Menus.
You can select the Category panel, select the Category and add to menu.
I wanted to know how to show post of certain category in a page. Means post on a page.
not menu or categories. Sorry for my bad english though!
Must be better than mine! Read what I said as that’s how to get a page of category posts!!
Well your instruction is good when somebody wants to use a category as a page of posts.
But my requirement is:
The page will be having its introductory content and after that the the related category posts should appear on that page. Hope I could give a clear idea this time.
What about a a page of posts?
Thats exelent but the problem is its for Twenty thirteen. I do not know what are the functions to use for customizr. ??
You can try this, but I think there will be better solutions:
1) copycustomizr/custom-page.php
toyour-child-theme/custom-page-of-posts.php
.
2) change the Template Name, likeTemplate Name = Page of posts
.
3) find this<?php endif; ##end if have posts ?>
, and after it write this (see this to know params for query_posts):<?php /*list of posts*/ query_posts('cat=YOUR_CAT'); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : ?> <?php the_post(); ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php endwhile; ?> <?php endif; ##end if have posts ?> <?php wp_reset_query() ?>
Mmm, to me it works, so or I have not explained it well, or you have made ??some mistakes in the implementation.
What kind of result do you have using that code?Well the posts doesnt show up on the pages ??
Nothing has changed so far.How is that possible?
Could you post somewhere (pastebin?) this custom page template which doesn’t work?Can you please check any of the pages in this url https://www.rhododendron.in
I looked at the page Cinema, ignoring the fact that there is some javascript that stuck (I had to disable javascript to load the page) with high cpu usage, I see that there you use the default template, so you’re not using a custom template for that page. Did you changed the default template? (wich is index.php, by the way).
Anyway I asked you to provide the code you was using in order to help you to figure out what could be the problem, I use the code I provided and it works for me. Also its logic is so trivial that it would be anomalous if it does not work.I think I have used the code that you provided.
I’ll provide you the code in few mins ..
Can you help me figure out the problem that is causing by the java script… and where is that exactly?
Code for custom page
<?php /* Template Name: Page of posts */ ?> <?php do_action( '__before_main_wrapper' ); ##hook of the header with get_header ?> <div id="main-wrapper" class="<?php echo tc__f( 'tc_main_wrapper_classes' , 'container' ) ?>"> <?php do_action( '__before_main_container' ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need! ?> <div class="container" role="main"> <div class="row"> <?php do_action( '__before_article_container'); ##hook of left sidebar?> <div id="content" class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container"> <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?> <?php the_post(); ?> <?php do_action ('__before_article') ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php do_action ('__after_article') ?> <?php endwhile; ?> <?php endif; ##end if have posts ?> <?php /*list of posts*/ query_posts('category_name=articles,international-cinema,photography,regional-cinema,travel'); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : ?> <?php the_post(); ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php endwhile; ?> <?php endif; ##end if have posts ?> <?php wp_reset_query() ?> <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?> </div><!--.article-container --> <?php do_action( '__after_article_container'); ##hook of left sidebar ?> </div><!--.row --> </div><!-- .container role: main --> <?php do_action( '__after_main_container' ); ?> </div><!--#main-wrapper"--> <?php do_action( '__after_main_wrapper' );##hook of the footer with get_get_footer ?>
Code of Index.php
<?php /** * The main template file. Includes the loop. * * * @package Customizr * @since Customizr 1.0 */ ?> <?php do_action( '__before_main_wrapper' ); ##hook of the header with get_header ?> <div id="main-wrapper" class="<?php echo tc__f( 'tc_main_wrapper_classes' , 'container' ) ?>"> <?php do_action( '__before_main_container' ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need! ?> <div class="container" role="main"> <div class="row"> <?php do_action( '__before_article_container'); ##hook of left sidebar?> <div id="content" class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container"> <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?> <?php if ( tc__f('__is_no_results') || is_404() ) : ##no search results or 404 cases ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php endif; ?> <?php if ( have_posts() && !is_404() ) : ?> <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?> <?php the_post(); ?> <?php do_action ('__before_article') ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php do_action ('__after_article') ?> <?php endwhile; ?> <?php endif; ##end if have posts ?> <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?> </div><!--.article-container --> <?php do_action( '__after_article_container'); ##hook of left sidebar ?> </div><!--.row --> </div><!-- .container role: main --> <?php do_action( '__after_main_container' ); ?> </div><!--#main-wrapper"--> <?php do_action( '__after_main_wrapper' );##hook of the footer with get_get_footer ?>
- The topic ‘certain category posts on a certain page’ is closed to new replies.