Issue with Custom Post Types and Single
The rewrite slugs for the News post type and News Category taxonomy are conflicting. Change the rewrite argument for the taxonomy to: ‘rewrite’ => array(‘slug’ => ‘news-category’,
The rewrite slugs for the News post type and News Category taxonomy are conflicting. Change the rewrite argument for the taxonomy to: ‘rewrite’ => array(‘slug’ => ‘news-category’,
I’ve updated and added to the code you’ve provided. Event post type: Changed post type name to from Eventi to eventi. Post type names cannot contain capital letters Changed has_archive to eventi Added rewrite arguments Post type links Added function to handle customized rewrite args Source 1, Source 2 This configuration will result in the … Read more
You can add the taxonomy parameter. function add_image_category_filter() { $screen = get_current_screen(); if ( ‘upload’ == $screen->id ) { $dropdown_options = array( ‘taxonomy’ => ‘YOUR_TAXONOMY’, ‘show_option_all’ => __( ‘View all categories’, ‘iCats’ ), ‘hide_empty’ => true, ‘hierarchical’ => true, // default is cat which wouldn’t filter custom taxonomies ‘value_field’ => ‘slug’, ‘name’ => ‘YOUR_TAXONOMY’, ‘orderby’ … Read more
In your custom templates, First you have to fetch all terms for your custom post type. You can use get_terms to retrive terms in taxonomy If you are using wordpress prior to 4.5 $terms = get_terms( ‘competition’ , array( ‘hide_empty’ => false ) ); OR if you are using wordpress prior to 4.5.0 or later … Read more
You need to either go into Settings -> Permalinks and click Save Or if you’re doing this programmatically you need to use flush_rewrite_rules(), but make sure this is only used when you activate/deactivate the plugin, DON’T set this in code that runs (like in init, or on every page load): https://developer.wordpress.org/reference/functions/flush_rewrite_rules/ register_deactivation_hook( __FILE__, ‘flush_rewrite_rules’ ); … Read more
wp_update_term() doesn’t changes taxonomy. It just updated the existing taxonomy. Say the below code- $update = wp_update_term( 1, ‘category’, array( ‘name’ => ‘Uncategorized Renamed’, ‘slug’ => ‘uncategorized-renamed’ ) ); if ( ! is_wp_error( $update ) ) { echo ‘Success!’; } This code finds the category which ID is 1, then updates it to the name … Read more
It seems like you need to override the canonical redirection on custom post types to get the pagination to work. It had nothing to do with the custom query used and described above, as that worked perfectly fine on a normal page and now also on a custom post type. I figured out that I … Read more
If your site is at the root of the domain (something like http://www.example.com), find the location / block inside the configuration file, and add the following line to it. try_files $uri $uri/ /index.php?$args; Here, Nginx checks for the existence of a file at the URL ($uri), then for a directory ($uri/). If it doesn’t find … Read more
You are going to need set up a new WP_Query in your content-*.php with the correct parameters in order to send it into a loop. <?php $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘recipes’,. ‘field’ => ‘slug’, ‘terms’ => ‘dessert’ ))); $your_posts = new WP_Query( $args ); ?> You can add any other … Read more
If your going to reference the uploads directory use https://developer.wordpress.org/reference/functions/wp_upload_dir/ <?php $upload_dir = wp_upload_dir(); // Array of key => value pairs /* $upload_dir now contains something like the following (if successful) Array ( [path] => C:\path\to\wordpress\wp-content\uploads\2010\05 [url] => http://example.com/wp-content/uploads/2010/05 [subdir] => /2010/05 [basedir] => C:\path\to\wordpress\wp-content\uploads [baseurl] => http://example.com/wp-content/uploads [error] => ) // Descriptions [path] – … Read more