Home Forums General Issues Custom Post Type as WordPress Front/Home


Custom Post Type as WordPress Front/Home

  • Hi all,

    I’ve done a pile of Googling around and don’t seem to have found a solution. I thought it was just a general WordPress issue, but I thought since it’s my ACF custom posts, then I might have some luck asking here.

    All I’m after is that under Settings > Reading or Appearance > Static Front Page, if it were possible to choose one of my custom posts to be the Home/Front from the dropdowns, instead of just standard pages.

    Many thanks in advance for any help given or even just a point in the right direction.

  • this looks like a good place to start

    EDIT: Oh, I don’t think you can change the options to show custom post types in the drop down. That drop down calls this function to get the list of pages wp_dropdown_pages() this function only has one filter and it is for the HTML string that’s returned with no way of really knowing what the string is generated for so if you altered this you’d pretty much be altering the output no matter where it is used.

  • Thanks for the links. I gave them a read through, but I think I’m going to have to try and figure an alternative. I need the Home page to be easily changed by an admin with limited WordPress experience, which is why I was hoping to sort an easy “choose from a dropdown” option for them.

    Instead of trying to get a post shown as Home. I might have to look into setting up a page, which does nothing but shows a post. And then hopefully which post that is, can be easily changed.

    Time to put my thinking cap on.

    Thanks for replying.

  • You could create an options page, or add a field to an options page, that lets the admin choose a post from your custom post type and then use the examples in from the links. Instead of setting a specific page as in the code you would get the value from your custom option field and use that value to set the post. The to eliminate confusion you could add some custom CSS to the regular admin page to hide the standard WP selection. Like I said, I dug around in WP code for a while and there’s no way that I can find that will allow you to alter that drop down.

  • I had a thought and it goes something like this…

        Using ACF, create a new Custom Field. I’ve just called it Home.
        Create a new Field. I’ve called that Select Post (select_post).
        Choose the Field Type: Select.
        Under Location – Rules, set it to Page is equal to Home.
        Make a single page index template.

    A problem with this plan is, how to fill that Select field, with all the custom posts.

    If I can figure that out, then I’ve allowed the admin to be able to simply choose a post from a dropdown, without any further WP knowledge and bypassing the standard Page dropdown under Reading.

    I’ll start Googling and trying different things, but do you think this is achievable?

  • OK, happy days. I found this handy little snippet. I applied it, changed out the values with mine and added it to my functions.php file.

    	// populate acf field (select_post) with post types (clients)
    	function acf_load_select_post( $field ) {
    		$field['choices'] = get_post_type_values( 'clients' );
    		return $field;
    	add_filter( 'acf/load_field/name=select_post', 'acf_load_select_post' );
    	function get_post_type_values( $post_type ) {
    		$values = array();
    		$defaults = array(
    			'post_type' => $post_type,
    			'post_status' => 'publish',
    			'posts_per_page' => -1,
    			'orderby' => 'title',
    			'order' => 'ASC'
    		$query = new WP_Query( $defaults );
    		if ( $query->found_posts > 0 ) {
    			foreach ( $query->posts as $post ) {
    				$values[get_the_title( $post->ID )] = get_the_title( $post->ID );
    		return $values;

    This populates the Select field on the page called Home. Huzzah!

    Now I just need to create my home page template to populate the page with the content of the selection. That would be the index.php file, right?

  • How can I add a custom post type using Gutenberg editor? I am trying but having some issues in code.

    ‘labels’ => array(
    ‘name’ => __( ‘Portfolio’ ),
    ‘singular_name’ => __( ‘Portfolio’ )
    ‘has_archive’ => true,
    ‘public’ => true,
    ‘rewrite’ => array(‘slug’ => ‘portfolio’),

    I am using this tutorial as reference

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

The topic ‘Custom Post Type as WordPress Front/Home’ is closed to new replies.