I have a site theme that is set to display either a post, portfolio, gallery or events.
I want to modify it so it will display from post category 'credits'.
The url is www.juliaandjulia.com
user: temp
password: wpquestions
Julio Potier answers:
Hello
I found the file and the line that have to be changed to do this.
But (i'm logged in your site) i do not see any "credits" category, event for custom post types.
Can you tell me more about this cat ? is another custom taxo i did not see ?
Thank you
<em>ps : price is low, i won't spend much time on this, sorry.</em>
kayode brown comments:
thanks for the response, I havent created a custom post type called credits, i was asking if it would be easier to do it that way.
having said that I don't think this question would take too much time to resolve.
Julio Potier comments:
i did not talk about a custom post type name credits but a category named credits.
<blockquote>I want to modify it so it will display from post category 'credits'.</blockquote>
Where is this cat in your site ??
kayode brown comments:
the custom post type is created.
I just need to add it to the dropdown and add posts to it
Julio Potier comments:
Ok In the file : <em>/hades_framework/option_panel/options.php</em> from your theme
find this :
$options[] = array(
"name" => "Enter Recent Posts Area Post Type",
"desc" => "you can select which posts to display here.",
"id" => $shortname."_home_rp_post",
"type" => "select",
"options" => array('post','portfolio','gallery','events'),
"std" => "post"
);
<em>use the word "home_rp_post" to find it, about line 528.</em>
Then add 'clients' to "options" value, kind of this :
$options[] = array(
"name" => "Enter Recent Posts Area Post Type",
"desc" => "you can select which posts to display here.",
"id" => $shortname."_home_rp_post",
"type" => "select",
"options" => array('post','portfolio','gallery','events','clients'),
"std" => "post"
);
See you
<em>ps : i suggest $15, your question talked about a category, then a CPT.</em>
Christianto answers:
Hi,
Looking at your theme admin screenshot, I think you only need to add more custom post type and taxonomy for it and it will appear in your dropdown panel "enter recent posts area post type" to be choose.
this is to create other custom type name "clients" and new taxonomy "credits", add this to your functions.php on your theme folder.
function product_register() {
$args = array(
$labels = array(
'name' => __('Clients',themename),
'singular_name' => __('Client',themename),
'add_new' => __('Add New',themename),
'add_new_item' => __('Add New Client',themename),
'edit_item' => __('Edit Client',themename),
'new_item' => __('New Client',themename),
'view_item' => __('View Client',themename),
'search_items' => __('Search Client',themename),
'not_found' => __('No Clients found',themename),
'not_found_in_trash' => __('No Clients found in Trash',themename),
'parent_item_colon' => ''
),
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'menu_position' => 5,
'hierarchical' => false,
'rewrite' => array('slug' => 'clients'),
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type( 'clients' , $args );
}
add_action('init', 'product_register');
// CUSTOM CATEGORIES
register_taxonomy(
"credit",
array("clients"),
array(
"hierarchical" => true,
"label" => "credits",
"singular_label" => "credit",
"rewrite" => true
)
);
kayode brown comments:
I did this and it added the clients to admin panel however in the theme shotzz options/home page/ settings (towards the bottom it doesn't list clients) it still says
post
portfolio
gallery
events
Arnav Joy answers:
can you explain what d you want ??
Arnav Joy comments:
you can use following:-
<?php
wp_reset_post();
query_posts('cat='.$catID);
if(have_posts()):
while(have_posts()):the_post();
the_title();
the_content();
endwhile;
endif;
wp_reset_post();
?>
kayode brown comments:
What i am trying to do is have 3 posts from the specified category displayed with just the image. The idea is to showcase the top 3 clients.
kayode brown comments:
where would I dump that code?
Arnav Joy comments:
use this
<?php
wp_reset_post();
$catID = IDOFTHECATEGORY;
query_posts('cat='.$catID.'showposts=3');
if(have_posts()):
while(have_posts()):the_post();
the_title();
the_content();
endwhile;
endif;
wp_reset_post();
?>
replace IDOFTHECATEGORY with the id of the category credits
can you paste here the url of the site than i can tell you where you have to put the code.
kayode brown comments:
http://juliaandjuliabridal.com/
not sure if thats what I'm looking for.
in the theme settings, it has the options for the type of posts to display, I want to add a post category to be displayed.