How can I load a PHP page without using a Template?

I think what you’ll want to do – or something like what I’d do in your place – is create a simple WordPress plugin. (I’m bold-facing things that you can search up – lots of material on all of this will be right at your fingertips on the internet, often in detail in the WordPress … Read more

Global variable $post returning incorrect object

Why is test-product-magazine, instead of the correct, shop? The global $post object is not a reliable way to determine anything about archive pages because the object will typically be the first post of the main query when outside the loop. Since the main query is for the posts in the archive and not the archive … Read more

WordPress menu permalink redirects to wrong page

Regenerate your permalinks. Resetting permalinks rebuilds your link structure for WordPress. Often, this process must be performed after migrating a WordPress website, or when troubleshooting 404 errrors. This is accompished by choosing a different permalinks setting, and saving it. Then putting the permalink setting back to the original setting and saving it again. This is … Read more

How get get list of pages in ajax search

There is no get_pages() method in the WP_Query class (for WordPress version 4.9.4). So in the data_fetch() function, replace the following: if( $the_query->get_pages() ) : while( $the_query->get_pages() ): $the_query->get_pages(); ?> ..with this: if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> And in the fetch() JS function, set the type to POST, like so: function … Read more

Create page that is not deletable

You can make use of the filters supplied via the delete/trash functions of WordPress API: wp_trash_post and wp_delete_post: function prevent_post_trash_delete($bool, $post){ $posts_to_keep = [30]; if ( isset( $post->ID ) && in_array($post->ID, $posts_to_keep) ) { return false; } return $bool; } add_filter(‘pre_delete_post’, ‘prevent_post_trash_delete’, 10, 2); add_filter(‘pre_trash_post’, ‘prevent_post_trash_delete’, 10, 2); You can pass an array of IDs … Read more

Get all pages that are published

You can use get_pages to get all the published pages, which is similar to get_posts, as <?php $args = array( ‘sort_order’ => ‘asc’, ‘sort_column’ => ‘post_title’, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ => ”, ‘meta_key’ => ”, ‘meta_value’ => ”, ‘authors’ => ”, ‘child_of’ => 0, ‘parent’ => -1, ‘exclude_tree’ => ”, ‘number’ => … Read more

How do I hide the current page’s title?

You can try this function wpb_hidetitle_class($classes) { if ( is_single() || is_page() ) : $classes[] = ‘hidetitle’; return $classes; endif; return $classes; } add_filter(‘post_class’, ‘wpb_hidetitle_class’); CSS code : .hidetitle .entry-title { display : none; } Source http://www.wpbeginner.com/plugins/how-to-hide-post-and-page-titles-in-wordpress-single-pages/

Way to querry data (tags) from a wordpress database?

Looking at your page the content is empty. <div class=”post_tags”></div> It seems you aren’t inserting that PHP code correctly into your page. To do so you have to two options: Without using a plugin. Add the following code in your functions.php function list_all_tags( $atts ) { $tags = get_tags(); $html=”<div class=”post_tags”>”; foreach ( $tags as … Read more