Getting 404 page for custom post type

I have created a custom post type in multisite but cannot get it to work once published. I get a 404 every time. It does show for a draft.

Also Is there any clearer documentation on how to get the Custom Taxonomies and Custom fields to show on the page. Without that capability this plugin doesn't help me. It should really express that you need to know php to make it work properly. Unless Im not seeing something which I hope is the case :slight_smile:

  • Tyler Postle

    Hey Brandon,

    Hope you're doing well today!

    You custom post types created through CustomPress should show up in the normal post format unless you have created a custom template for them.

    When creating a taxonomy it will ask you which post type it's for, select your custom post type and then it should show a category select option for that post type now in the edit screen :slight_smile:

    As for Custom fields, this is where it does get a little bit more tricky because you have to tell your custom post type where to display the custom field. You will notice on the custom field that there is an "Embed code" link. This will have both a php embed option and just a simple shortcode that you can place inside your post.

    It also gives you 3 property values, looking like this:

    [ct id="_ct_text_4cfeb3eac6f1f" property="title | description | value"]

    If you want it to show only the value of the custom field then remove "title" and "description" and all the separators.

    You don't need any php coding knowledge unless you want to create a completely custom post template.

    As for the 404's your seeing, can you try re-saving your permalinks? :slight_smile: you can do that via settings > permalinks.

    If that doesn't help then can you let me know which subsite you are trying this on? Then I can take a look at your settings. I checked a few of your sites but they didn't have any content types yet.

    Look forward to hearing back!

    All the best,
    Tyler

  • Brandon

    Ok I appreciate your fast response. I believe I understand what needs to be done other than the 404 error I keep getting. The subsite Im using is team.lifetogethergroups.com. The error page is team.lifetogethergroups.com/meeting_minutes/test-2/

    I would like to learn how to implement these steps with PHP that way it is a permanent setup. My end goal is to create separate plugins that are specific to the businesses I consult. I want it to be easy for someone who is not familiar with shortcodes to add posts to the custom post type I create via the Custom Fields and Taxonomies I give the Post Type. (I hope all this makes sense :slight_smile:.

    Any Help is appreciated :slight_smile:

  • Tyler Postle

    Hey Brandon,

    Thanks for the reply!

    Yes, so to implement the custom fields through the template so it's permanent and no shortcodes need to be added in the post itself, you would use the shortcode in the template :slight_smile:

    First you will want to make a copy of your single.php template and re-name it single-$posttype.php

    $posttype = the name of your post type. So in this case looks like it would be single-meeting_minutes.php

    Then insert the fields there where you want the values to show up.

    Like this for your date of meeting field:

    <?php echo do_shortcode('[ct id="_ct_datepicker_54ef65f4e8a57" property="value"]'); ?>

    That should reflect the date chosen while creating the post.

    Long as this template is in your themes folder then it will be used instead of the default single.php template.

    I would recommend a child theme if you aren't already using one because if the parent theme gets updated and your custom single template is in there then it will get overwritten.

    As for the 404 errors you're getting, can you temporarily swap to the default 2015 WordPress theme? I'm wondering if maybe the issue is a conflict with your theme. Swap to that theme then re-save permalinks and see if your posts show up correctly :slight_smile:

    Look forward to hearing back!

    All the best,
    Tyler

  • Brandon

    Ok 404 is still happening but I have figured out how to place the PHP. I can get it to appear above the Title of the post and in the footer but how can I place it Below the Title of the Post?
    Here is my code.

    <?php
    /**
     * Single Post Template
     *
     * This template is the default page template. It is used to display content when someone is viewing a
     * singular view of a post ('post' post_type).
     * @link http://codex.wordpress.org/Post_Types#Post
     *
     * @package WooFramework
     * @subpackage Template
     */
    
    get_header();
    ?>
    
        <!-- #content Starts -->
    	<?php woo_content_before(); ?>
        <div id="content" class="col-full">
    
        	<div id="main-sidebar-container">    
    
                <!-- #main Starts -->
                <?php woo_main_before(); ?>
                <?php echo do_shortcode('[ct id="_ct_datepicker_54ef65f4e8a57" property="value"]'); ?>
                <section id="main">
                <?php echo do_shortcode('[tax id="team_members" before="Team Members " separator=", " after=" attended this meeting"]'); ?>
    <?php
    	woo_loop_before();
    
    	if (have_posts()) { $count = 0;
    		while (have_posts()) { the_post(); $count++;
    
    			woo_get_template_part( 'content', get_post_type() ); // Get the post content template file, contextually.
    		}
    	}
    	woo_loop_after();
    ?>
                </section><!-- /#main -->
                <?php woo_main_after(); ?>
    
                <?php get_sidebar(); ?>
    
    		</div><!-- /#main-sidebar-container -->         
    
    		<?php get_sidebar('alt'); ?>
    
        </div><!-- /#content -->
    	<?php woo_content_after(); ?>
    
    <?php get_footer(); ?>
  • calvinrogercanas

    Hey there @Brandon,

    Hope you're well! :slight_smile:

    It is weird you got 404 here. I want to take a closer look.

    Can you please send in:

    - In the subject field add "Attn:Calvin Canas"
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Looking forward for your reply! :slight_smile:

    Best Regards,
    Calvin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.