Display content from “About Us” page on the Home Page

If you’re using WP_Query, then assign that page a custom meta key ‘home_content’ with a value as 1. Then use WP_Query’s custom field parameters to loop over it. If you can restrict the title as ‘About’ everywhere, use get_page_by_title, and if you can restrict the slug as ‘about’, use get_page_by_path. These methods will work dynamically.

Please help me to win the battle with 2 column loop by category

You should not use query_posts more than one time. It will create errors. You have to use wp_query. Here is what it says in wordpress codex: query_posts( is meant for altering the main loop. Once you use query_posts(), your post-related global variables and template tags will be altered. Conditional tags that are called after you … Read more

WordPress loop: Display if posts exist

You can use the has_tag function in a conditional statement to achieve what you want. Take a look at the codex page here: Function Reference/has tag. This isn’t 100% tailored to your specific question, but you should see how it’s working and adjust for your specific task: <?php if( has_tag() ) { ?> <?php query_posts( … Read more

Use Loop or direct database query?

In general I try to avoid custom SQL queries as much as i can and use the native WordPress functions but in some cases its much better/faster to use custom queries. if the case is just get a list of posts the you can use the WP_Query or get_posts which will work almost as fast … Read more

The Loop for my theme with static front page is not working

Just before the snippet i posted i was doing something like $posts = array();, it seems that wordpress keeps the collection of the posts to be used on the loop in a variable of the same name, so i was meesing with the data, just changed $posts for $items and now works fine.

In Loop Output Place Custom Field Content In Between Paragraphs

After researching this, here is what works for me: <?php $paragraphAfter= 1; //show box after selected paragraph $content = apply_filters(‘the_content’, get_the_content()); $content = explode(“</p>”, $content); for ($i = 0; $i <count($content); $i++) { if ($i == $paragraphAfter) { ?> <!– START OF BLOCKQUOTE –> stuff <!– END OF BLOCKQUOTE –> <?php } echo $content[$i] . … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)