get_pages gives wrong ID for blogpage

No, the blog page is just a regular page, it has no special ID number and it can be anything. The only special thing about a blog page is that it was assigned to use as a “blog” page and you can check for its ID value in one of the options.

add anchor tags rel to thumbnails id

You can add ID’s to thumbnails like this. <?php $attributes = array( “class” => “main-image portfolio ” . $extraLastClass, “id” => “photo_” . $post->ID, ); the_post_thumbnail( “large”, $attributes ); ?> Notice I have append id with $post->ID.

Categories id Tags

Subcategory IDs in relation to parent category ID switch case

Ok. This code: $cat_id_gum=””; if(($category[0]->parent)!=’0′) { $cat_id_gum=$category[0]->cat_ID; } elseif(($category[1]->parent)!=’0′) { $cat_id_gum=$category[1]->cat_ID; } elseif(($category[2]->parent)!=’0′) { $cat_id_gum=$category[2]->cat_ID; } else { $cat_id_gum=$category[3]->cat_ID; } Is not really necessary. I’ll show you what I mean in a bit. Later, however, you then set $cat_id_gum to the current post ID… $cat_id_gum = get_the_ID(); … which doesn’t make any sense and makes … Read more

get post by nav id

I think you need to loop the $menu_items because the function, according to the Codex, returns a array. Remplace echo $menu_items->ID; with foreach ( $menu_items as $menu_item ) { echo $menu_item->ID; } I need to check the array exactly, but if you need to compare a post ID to a menu item, you will need … Read more

Categories id Tags

get page id’s – not get pages?

Use the parameter ‘fields’: $pages = get_posts( array( ‘post_type’ => ‘page’, ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘product.php’, ‘fields’ => ‘ids’ ) ); Not tested, but it should fetch just the IDs.

Categories id Tags

How can I exclude a specific ID from this line of code?

On a seperate note, ‘caller_get_posts’ was deprecated in version 3.1 – use ‘ignore_sticky_posts’ with a boolean argument instead. ‘exclude’ is not a query argument so WordPress ignores it. Post exclusion via query is done using the key ‘post__not_in’ with a single post ID or array of IDs instead. However as @vancoder points out, the argument … Read more

Why does the page/post ID keep growing when i refresh the post-new.php file?

This is normal behaviour, as I understand it. When you load the page post-new.php, you run this function: $post = get_default_post_to_edit( $post_type, true ); where the second argument stands for $create_in_db. If true then this part is executed: if ( $create_in_db ) { $post_id = wp_insert_post(…); } inside get_default_post_to_edit().

Categories id Tags