How to create a page with the selected template after activating the plugin
How to create a page with the selected template after activating the plugin
How to create a page with the selected template after activating the plugin
As your code looks quite generic, the obvious answer and thing to debug is that either the if condition is not true when you’re expecting it to be, or $media_content isn’t getting generated as you expect. Are you 100% sure that on all the other sites the post_type is ‘my_custom_post_type’ when you expect it to … Read more
I see you’re using functions such as the_permalink that echo their values, but don’t return them, yet you’re using them as if they do return values, which they don’t. Aside from a few exceptions, WP functions that start with the_ don’t return data, they echo it, so you have to use functions such as get_permalink … Read more
How to include a page template and template part into my plugin
WP loads jQuery in no conflict mode, so you can either swap $() for jQuery(), or wrap it in a function, e.g. (function($) { // Code using `$` … })(jQuery);
Home page is not loading, where in other pages are displaying on the site
If you were to use WP_Query to retrieve a list of posts, you can then access the number of posts using ‘found_posts’. e.g. (from the support pages) $query = new WP_Query( array( ‘author’ => 123, ‘post_type’ => ‘posts_comcurso’ ) ); Would return all posts with a userid of 123 in your selected post type. Then … Read more
I think for shortcodes, which are generally used in the WYSIWYG editor by non-technical users, it’s best to keep the parameters simple: [custom-shortcode color=”red” size=”medium”] In other words, shortcodes are designed to provide functionality that an end-user can place somewhere in their content, with the option of supplying a few different customizations. For obtaining something … Read more
As per confirmation from @Jacob Peattie, my understanding is now this (if it is helpful to future readers). AJAX calls to a WordPress plugin method exist in a totally separate context (separate requests) from the object instance created when a WordPress plugin’s PHP files are interpreted when a page is loaded. Therefore, a property that … Read more
ajax call return 406 not acceptable for non logged users only