Custom URL Structure for posts with subcategories
Custom URL Structure for posts with subcategories
Custom URL Structure for posts with subcategories
Your best way would be to redirect to the theme’s 404 page in the event that the page being loaded matches the slug that you are referring to. Try this: function check_undesirable_page(){ global $post; if(is_page() && ($post->post_name==”YOUR-SLUG-HERE”)){ global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( ‘wp’, ‘check_undesirable_page’ ); EDIT: Also a good idea to incorporate the … Read more
Your code is going to cause a fatal error as you have defined a function inside a loop, and therefore are redefining the function at every iteration thereafter. That is part of the problem. Take a look at cleaned up code: function pw_show_gallery_image_urls( $content ) { global $post; // Only do this on singular items … Read more
$arr_str = new SimpleXMLElement(‘<a href=”www.example.com”>Click here</a>’); echo $arr_str[‘href’]; // will echo www.example.com Note that, SimpleXMLElement required PHP version above 5.
problem getting audio url
How to retrieve a post by inputing the url in a custom field and displaying it on an options page
To grab the img tag as a variable: get_the_post_thumbnail ( int $post_id = null, string|array $size=”post-thumbnail”, string|array $attr=”” ) or if you want to outright echo it: the_post_thumbnail ( string|array $size=”post-thumbnail”, string|array $attr=”” ) Most things like the post content, excerpt, title etc, are acquired using functions like this so that filters and hooks can … Read more
How to change post template via url?
You can configure that in admin panel. Just go »Dashboard > Settings > Permalink« settings.
Simply you need to replace the_field(‘video’) with get_field(‘video’). Why? Because according to ACF documentation; get_field($field_name, $post_id, $format_value) Returns the value of the specified field. Whereas on the other hand the_field($field_name, $post_id) Displays the value of the specified field. (this is the same as “echo get_field($field_name)”) Hope this might help others as well.