Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #277326

    I wanted to see if there was an easy way to specify a sidebar for a custom post type. It currently takes on the archive sidebar and title. I would also like to customize the title so that it is the title rather than the Blog – Latest News. Would I need to create a custom page theme?

    Thanks for the help.
    Ryan

    #277396

    Hey rpletcher!

    You should create your custom post types own custom page template and/or archive template with specific support for its own widget area.

    Quite a bit beyond what we can assist with through support but the WordPress codex has really good documentation for CPTs as well as links to even more docs and tutorials.

    Regards,
    Devin

    #277398

    Hey rpletcher!

    If you want to customize the sidebar you can use a plugin like: http://wordpress.org/plugins/display-widgets/ or http://wordpress.org/plugins/widget-logic/

    To change the page title you need to insert this code into the child theme functions.php file (or enfold/functions.php):

    
    add_filter('avf_title_args', 'fix_blog_page_title', 10, 2);
    function fix_blog_page_title($args,$id) {
    $args['title'] = get_the_title($id);
    $args['link'] = get_permalink($id);
    return $args;
    }
    

    – it will replace Blog – Latest News with the current post title. If you want to set a specific text for all custom post type entries use this code:

    
    add_filter('avf_title_args', 'fix_blog_page_title', 10, 2);
    function fix_blog_page_title($args,$id) {
    if(get_post_type($id) == "mycpt"){
    $args['title'] = "My cpt page title";
    }
    return $args;
    }
    

    and replace mycpt with your custom post type slug and “My cpt page title” with your custom page title.

    Regards,
    Peter

    #278434

    Thanks for the information I was able to update the theme and add a theme page for the post type. It also worked for an issue that I was having with another plugin.

    Thanks

    #278555

    Hi!

    Great, glad it works now :)

    Regards,
    Peter

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Custom Post type’ is closed to new replies.