Tag Info

Hot answers tagged

3

The last line tells WP to run this function on the pre_get_posts hook. That hook is the ideal place to modify the main query that will be run in order to build the page. In this case, exclude_featured_tag() checks whether WP is loading the home page, and whether it's about to call the main query for the page (as opposed to any other secondary queries being ...


2

Your actual question is basically when to run a custom query and when to make use of the main query. Lets break it down in three parts PART ONE When to run a custom query (This is not a definitive list) To create custom content sliders To create a featured content area in a page On page.php templates if you need to display posts If you require custom ...


1

I have figured out how to make a cookie system per-page and not on a site wide setup: I setup a java script section in my webpage to create the cookie (the text editor). Here is the code that I used: <script type=”text/javascript”> <!– document.cookie=”AuthCookie=OpenSesame; Domain=example.com; path=/”; //–></script> Hope this helps ...


1

Have you tried to use get_children() function? Edit: All media attached to any post is treated as children of it. The function wp_get_attachment_image() will only return images. With the function get_children() you'll be able to get all the media, images or anything else. In the above link, you can find some examples.


1

You can probably use the language_attributes filter (from the language_attributes() function) to add it. It should receive an output like lang="en" and you can add to it before printing to the <html> tag: add_filter( 'language_attributes', function( $attr ) { return "{$attr} manifest=\"manifest.appcache\""; } ); or without a anonymous function ...


1

You just need to return the user ID in the main select and use that as the author ID. Also I probably confused the issue previously by using echo with commas (separate arguments) rather than dots (one concatenated argument). $weekly = $wpdb->get_results ( " SELECT u.ID, ( SELECT ...


1

Your code will be like this if( have_posts() ): while( have_posts()): the_post(); $txt_fld = get_post_meta( get_the_ID(), 'dbt_text', true ); $txt_fld2 = get_post_meta( get_the_ID(), 'dbt_text', true ); endwhile; endif; echo $txt_fld; echo $txt_fld2 like this way.


1

save the id in a variable like this way $post_id = get_the_ID(); now you can use this $post_id variable in the hidden field.


1

A custom template for one specific category should be named category-slug.php where "slug" is the WP slug for the category. WordPress will automatically use this file to display the archive for that one category. You could also name it using the ID of the category. If your category is "legacy-posts", then your template file should be named ...



Only top voted, non community-wiki answers of a minimum length are eligible