Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #223718

    Hi, I am having trouble getting the links to point to the articles.

    I have this setup:
    – Page (called ‘offender register’), it has 5 avia blocks each containing content element ‘blog posts’. This is pulling in entries from a custom taxonomy.

    This works well.

    However, then I click on any post I get a 404.

    This is my cpt and taxonomy setup code:

    <?php  //HATE Reports
    // Register Custom Post Type
    add_action('init', 'reports_init');
    function reports_init() 
        //Labels for cusotm post type.
        $report_labels = array(
            'name' => _x('Reports', 'post type general name'),
            'singular_name' => _x('Report', 'post type singular name'), 
            'all_items' => __('All Reports'),
            'add_new' => _x('Add new report', 'report'),
            'add_new_item' => __('Add new report'),
            'edit_item' => __('Edit report'),
            'new_item' => __('New report'),
            'view_item' => __('View report'),
            'search_items' => __('Search in report'),
            'not_found' =>  __('No report found'),
            'not_found_in_trash' => __('No report found in trash'), 
            'parent_item_colon' => ''
        $args = array(
            'labels' => $report_labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true, 
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'menu_position' => 5,
            'supports' => array('title','editor','thumbnail','comments', 'report-cat', 'author'),
            'taxonomies' => array( 'report-cat', 'post_tag' ),
            'has_archive' => 'report'
    //Add new taxonomy upon WordPress initialization
    function report_create_taxonomies() 
        // Report Categories
            'hierarchical' => true,
            'label' => 'Report Categories',
            'singular_name' => 'Report Category',
            'show_ui' => true,
            'query_var' => true,
            'rewrite' => array('slug' => 'report-cat', 'with_front' => FALSE),
            'capability_type' => 'post',
    add_action( 'init', 'report_create_taxonomies', 0 );

    Permalink setting are set to:
    Post name http://localhost/sample-post/

    I can reach the archive page for the cpt categories via:






    This is an example link given above the wp editor for a post in the anti-gay category:


    I have tried everything to get this to link correctly but am now hairless.

    How can I use CPT with the blog post in the avia builder?



    Hey Vince!

    First try switching from pretty permalinks to default and see if it works. It could just be your htaccess is in need of a refresh.



    Hi Devin,

    Thanks for the reply. I have pushed to the server and it seem ok up there. Still can’t get it to work on my localhost though. (mamp)? I have deleted and recreated the .htaccess file. Any other Ideas?

    Now, the top left of the bread crumbs says ‘Blog’. The right hand side says “You are here:Home / Reports / Racist 3″

    How can I specify a template for the CPT so that posts from the Reports category (reached via the blog content item in the Avia layout builder). ?

    Thanks, VIncent


    Found the solution for the 404 (it was a naughty plugin)

    I still need a hand changing template for the cpt so it is different to the blog.




    You can create a file called loop-report.php on the includes folder then edit config-templatebuilder > avia-shortcodes > blog.php. Find this code on line 259:

    get_template_part( 'includes/loop', 'index' );

    Replace it with:

    if(!is_page( 42 )) {
    				get_template_part( 'includes/loop', 'report' );
    				} else {
    				get_template_part( 'includes/loop', 'index' );

    Replace 42 with your cpt page id or the name of the page where you want to show the custom post type report. Edit loop-report.php if you want to change the layout.

    Best regards,


    Ok, I am with some of that but not all of it.

    I have:

    1) duplicated loop-index.php and renamed it to loop-report.php
    2) amended the code in blog.php on line 279 to read :

    if(!is_page( 'report' )) {
    				get_template_part( 'includes/loop', 'report' );
    				} else {
    				get_template_part( 'includes/loop', 'index' );

    Here is the bit I dont get…. I do not have a page id to add here. I am only having trouble when looking at the post itself (single.php ?) of the cpt named report. If I understand the code you suggested correctly, I am asking if is NOT page ‘report’, get the me the index loop. if it is, get me the report loop. But, there is no page ID for a single post I can use as I would like this to take effect for all future posts into any category inside the cpt reports.

    Please have a look at the dev site for clarification: – bread crumb reads ‘Offender Register’ (page with avia blog post layout – Says what I want)
    http://localhost/report-cat/racism/ – bread crumb reads ‘Archive for: Racism’ (Archive view for category of Reports CPT – say what I want)
    http://localhost/report/racist-3-2/ – bread crumb reads ‘Blog’ (Single Post – does NOT say what I want)

    Thanks for any further suggestions/clarification, I am probably being stupid and missing something simple.



    If you want to change the single.php layout use a special single.php template for each cpt. You just need to append the cpt slug to the template name. I.e. the portfolio post type template name is: single-portfolio.php. Based on the code you posted in your first post you must name the cpt template single-report.php. Inside the single-report.php template call the loop template with

    get_template_part( 'includes/loop', 'report' );

    Best regards,


    I see….starting to make sense of the enfold theme logic.

    Sweet, Thanks..

    I have another question (maybe I should ask from a new one but as I am here)

    I am using the post slider and I wish to edit where it links to so that instead of linking to a post, it pulls a larger image from uploads when clicked on. I also wish to edit the meta. My problem is I cant seem to find the code that generates the slider.

    Where can I make a duplication of the slider code and apply it to a specific page?
    The page I want to edit is
    I wish the post image to link like on this page:



    You can edit the post slider element on config-templatebuilder > avia-shortcode > postslider.php. For further customization, please visit Werkpress.

    Best regards,


    Wonderful. Thanks for the help, Great theme.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Custom Post Types and permalinks…?’ is closed to new replies.