Custom post type shortcode with taxonomy attribute not working and no errors
Custom post type shortcode with taxonomy attribute not working and no errors
Custom post type shortcode with taxonomy attribute not working and no errors
Your class has no __construct() method. Even if it did, you’re not calling the class to set it up So… 1) at the top of your class, add: function __construct() { register_cpt(); } 2) after your class, add: $myCPT = new Dw_Mf_Register_CPT(); Or, you could just get rid of the class construction altogether. You don’t … Read more
How can I use a custom template to load custom post type posts based on a post_meta value
Right now you are looping the default WP_Query. Better to define the exact query to fetch the exact posts you want. Here is a link to the complete guide of how to use it, and how to use taxonomies: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
Hook create / update post
The only way I can think of to do it would be using the save_post action hook. Since your article isn’t being saved through AJAX, and only when you actually save the post, that would be the best place, in my opinion. I honestly haven’t written a lot of error messages, so this might be … Read more
I decided to rewrite my code and no longer use JS to open the Modal window, but pure CSS. I then attached the POST ID to the ID tag so that each modal window would be unique. code for a tag below. Href matches the ID on modal div. <a href=”#open-modal-<?php echo $post->ID; ?>” class=”button … Read more
You’re describing the default behaviour. Based on your code, you will have the following URLs: https://www.url.com/blog/addresses/ The archive of all Articles. https://www.url.com/blog/city/tunis/ The archive of all Articles assigned to the Tunis City. https://www.url.com/blog/addresses/article-title/ The single Article. If any of these URLs are returning a 404, you likely just need to flush your permalinks. This needs … Read more
Persist meta box choices throughout all posts of same post type
I think you should be able to do this: HTML: <a class=”view_post_details” href=”#” post_id=”<?php the_ID(); ?>”>View Post Details</a> JS: $(“.view_post_detals”).click(function () { var id_post = $(this).attr(‘post_id’); $.ajax({ type: ‘POST’, url: ‘<?php echo admin_url(‘admin-ajax.php’); ?>’, data: { ‘post_id’: id_post, ‘action’: ‘f711_get_post_content’ //this is the name of the AJAX method called in WordPress }, success: function (result) … Read more