Categories
CMS Mastering Development Wordpress

Multiple Select on Gutenberg Sidebar as metakey

I want to show a multiple select element in the sidebar when editing a page in admin, where I can save the selected values in a metakey. Of course also load the selected values upon load of page-edit in admin. I manage to show the list, but I don’t know how to save it i […]

Categories
CMS Mastering Development Wordpress

Why is my archive page looping through all but one post?

I’ve created an archive page for my custom posts, it loops through every one except the first. There is 11 posts overall and I only get 10 on the archive page. Here is my archive template: <div class="container"> <h2 class="entry-title text-center pt-5">Market Place</h2> <p class="text-center">Filter providers by service and click on the logos shown below […]

Categories
CMS Mastering Development Wordpress

Woocommerce style permalink structure

I was wondering how I use a custom post type written in code and make the URLs work similar to Woocommerce products. For example, I want my custom post type to work like so: /produce/ — archive of items /produce/vegetables/ — custom category archive of vegetables /produce/vegetables/carrot/ — instance of custom post type, in the […]

Categories
CMS Development Wordpress

Custom post type defaults to index.php for archive page

I’ve developed a custom theme with a custom post type named events. For some reason, however, WP refuses to use my archive page template with the file name archive-events.php per WP’s template hierarchy. WP keeps defaulting to index.php as the template for this post type. Previously I had a page configured in WP that was […]

Categories
CMS Development Wordpress

custom post type unique slug causing issues with post id

I’ve included all of the relevant code below. Here is what I’m trying to accomplish: A custom taxonomy of flavor. A custom post type of product. The ability to have flavor/product-name and another-flavor/product name vs product-name & product-name-2. What I’m experiencing with the code below is on the front end the 2nd product with the […]

Categories
CMS Development Wordpress

Get next and previous posts links

I have a custom taxonomy, custom post add_action( ‘init’, ‘cptui_register_my_cpts’ ); function cptui_register_my_cpts() { $labels = array( “name” => __( ‘Events’, ” ), “singular_name” => __( ‘event’, ” ), ); $args = array( // HERE “label” => __( ‘Events’, ” ), “labels” => $labels, “description” => “”, “public” => true, “publicly_queryable” => true, “show_ui” => […]

Categories
CMS Development Wordpress

Custom Post Type Single Page and Archive Page redirects to Home Page

I’ve been battling with this for a while. I have a CPT created with PostTypes (I have used this library many many times in other projects w/o problems): $volunteer = new PostType( ‘volunteer’ ); $volunteer->options( array( ‘supports’ => array( ‘title’ ), ‘capability_type’ => ‘post’, ‘publicly_queryable’ => true, ‘show_in_rest’ => false, ‘has_archive’ => true, ‘public’ => […]

Categories
CMS Development Wordpress

Custom Post Type Single Page and Archive Page redirects to Home Page

I’ve been battling with this for a while. I have a CPT created with PostTypes (I have used this library many many times in other projects w/o problems): $volunteer = new PostType( ‘volunteer’ ); $volunteer->options( array( ‘supports’ => array( ‘title’ ), ‘capability_type’ => ‘post’, ‘publicly_queryable’ => true, ‘show_in_rest’ => false, ‘has_archive’ => true, ‘public’ => […]

Categories
CMS Development Wordpress

When updating non-public custom post type it says “Post updated. View Post”

I create a custom post type like this: add_action( ‘init’, function() { $args = array( ‘description’ => ”, ‘public’ => false, ‘publicly_queryable’ => false, ‘show_ui’ => true, ‘show_in_rest’ => false, ‘rest_base’ => ”, ‘has_archive’ => false, ‘show_in_menu’ => true, ‘exclude_from_search’ => false, ‘capability_type’ => ‘post’, ‘map_meta_cap’ => true, ‘hierarchical’ => false, ‘rewrite’ => array( ‘slug’ […]