Articles of posts

Tell WP to use a specific template file in posts

I’ve searched everywhere and tried a couple plugins with no success. I’m using WP 3.9.1. I have to create different ways to show my posts. If they are “standard” they use the single-post.php. That’s ok. If they have an image gallery, I want to change the whole structure. Same thing if they contain a video. […]

Changing default WP-Site creation date

I started creating WP-Site this January-2015 but as per my project I need to include posts which are from year 2007 I created posts with the required date now I used a calender which sorts posts when we select required date in it.Now my problem is that calender only showing this January in it and […]

Get post ID from a link

I will try to explain my issue as good as i can. Please take a look at the following page in my website. We have: The main page Inside the main page there is a “view offer” button The “view offer” button links to a post. The post has an expiration date (done through a […]

get_post_custom stripping styling issue

I found this thread: Paragraphs removed when using get_post_custom()? Was hoping someone could either help me a little more though.. My code: <?php $post_customs = get_post_custom(); //$post_customs = get_field_objects(‘project_items’); if(isset($post_customs[“project_items”]) && count($post_customs[“project_items”]) > 0) { $project_items = $post_customs[“project_items”][0]; $projectItems = explode(“:”,$project_items); ?> <?php if(count($projectItems) > 1) { $totalProjectItems = $projectItems[1]; for($i = 0; $i < […]

How to show show the Second page title in the page

I am using a page hierarchy and I want to show the title of the 2nd parents The structure is something like Main Page Main Page > Second page Main Page > Second page > Third page Main Page > Second page > Third page > Fourth page I want to show the Second page […]

wp_update_post question on array

How can I run the wp_update_post function on an array of post ids.It doesn’t seem to respond to an array although I don’t get an error and only seems to work for one? $post_id = array(1235,1234,1228, 1221, 1211, 1212, 1208, 1200); $post = array( ‘ID’ => $post_id, ‘post_status’ => ‘pending’ ); wp_update_post($post);

Get posts with multiple categories

How to get just the common posts of 2 different categories? consider this category tree: posttype -news -arrangement –course –competetion –other region -region1 -region2 -region3 Now I want to get the posts in categories ‘news’ and ‘region2’. I have tried this: $query = new WP_Query(‘category__and=12,32’); // 12=news, 32=region2 But then I get all the posts […]

Published content not displaying, getting not found message

I am posting data in wordpress but after click on public it is showing This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help. I dont have any idea how to resolve this. I am using wordpress4.1 Screenshots After click […]

What are the benefits of setting a “featured image” for a WP blog post?

I read about the WordPress “featured image” feature but I didn’t understand the benefits of it yet. Does it change the blogs theme layout or is it just used for the blog post layout?

How to get links to the last N posts in a specific category?

I want to display the titles of the last N posts in a specific category. I am using the following code: <?php $cat_id=get_cat_ID(‘category1’); $posts = get_posts (“cat=$cat_id&posts_per_page=3”); if ($posts) { foreach ($posts as $post): setup_postdata($post); ?> <h2><?php //the_title(); ?> </h2> <?php next_post_link( ‘%link’, ‘Next post in category’, TRUE ); ?> <?php //the_content(); ?> <?php endforeach; […]