category menu item's weird behavior

Best WordPress theme for festivals or other events with responsive, clean and unique design.
GK User
Sat Mar 09, 2013 3:39 am
I created a new category of speakers called "moniteurs" and created a menu item to show them on a page.
I duplicated the category-speakers.php page and renamed the duplicate category-moniteurs.php

But when I click on either menu item, the result is the same. All the speakers from both categories shows on the page. This is a weird behavior. I want only the "moniteurs" to show on the moniteurs page and only the "speakers" to show on the speakers page.


Please help. Is there a line of code to add to category-moniteurs.php page ?


Image
User avatar
Expert Boarder

GK User
Sat Mar 09, 2013 12:51 pm
This is a temporary fix until developers find a different approach, Edit following files.

category-speakers.php
category-moniteurs.php

Find Line 14 which is below
Code: Select all
$args = array( 'post_type' => 'gavern_speakers', 'posts_per_page' => 100 );


Replace with below code for speakers
Code: Select all
$args = array( 'post_type' => 'gavern_speakers', 'posts_per_page' => 100, 'category_name' => speakers );

Replace with below code for moniteurs assuming that is the category name.
Code: Select all
$args = array( 'post_type' => 'gavern_speakers', 'posts_per_page' => 100, 'category_name' => moniteurs );


See you around...
User avatar
Platinum Boarder

GK User
Sat Mar 09, 2013 3:14 pm
Hi,

The problem was caused by fact, that the category-speakers.php file is used to display the speakers posts only - the best way to don't mix speakers with other posts is creating another custom post type analogically to the speakers implementation.
User avatar
Administrator

GK User
Sat Mar 09, 2013 3:25 pm
I want to showcase the "moniteurs" who only come on stage between speakers for a stand up routine.
It looked quite logical to me that I could just create a category and call it "moniteurs" and create a menu item to show the moniteurs on a page, just like the speakers.

I will try the fix and I'll let you know.

It should be a good implementation do allow that to be done. This is such a beautiful theme.


Or else, maybe provide a way to do a custom post without to much coding.

If it's only a matter of duplicating and renaming, I might try…


What's on take on this ?
User avatar
Expert Boarder

GK User
Sat Mar 09, 2013 3:31 pm
Houston, we have a problem:

Code: Select all
Fatal error: Call to a member function have_posts() on a non-object in /public_html/roadgirls/2/wp-content/themes/Fest/category-speakers.php on line 35
User avatar
Expert Boarder

GK User
Sat Mar 09, 2013 3:36 pm
The code provided by NormanUK contains an error - the category name isn't placed inside quotes like below:

Code: Select all
$args = array( 'post_type' => 'gavern_speakers', 'posts_per_page' => 100, 'category_name' => 'moniteurs' );
User avatar
Administrator

GK User
Sat Mar 09, 2013 3:44 pm
it works !!!
thank you, I had made a mistake in applying the fix.
User avatar
Expert Boarder

GK User
Sat Mar 09, 2013 3:47 pm
You guys rule ! Thank you

Image
User avatar
Expert Boarder

GK User
Sat Mar 09, 2013 3:53 pm
Just for the record, the code by NormanUK works as is. The mistake was mine in applying it.
I had replaced both line 14 and 15 by his code. That was my mistake not his.
Only line 14 need to be replaced by NormanUK's code.

Thank you again.
User avatar
Expert Boarder


cron