WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use to generate the ogp tags in themes I code but this commercial one is beyond my knowledge. The client want to share a page but any image option shows up.

Instead of a taxonomy-name.php template file, this theme rely on a page templates, where user choose the category/taxonomy to display the gallery from. Problem is: I can't get the attachments as the gallery renders after the query, I do will ask the theme autor to implement this but right now I need to fix this some way.


share|improve this question
Okay, that wasn't very clear. So, you just want to show different opengraph meta tags for different pages? Something like this? pastebin.com/kVZ1aiyY – its_me Jul 15 '12 at 4:05
up vote 2 down vote accepted

If it is a page the global post object is already set when wp_head fires. But you have to get the data for this page with custom code.

Pseudo code:

add_action ( 'wp_head', 'wpse_58539_get_ogp' );

function wpse_58539_get_ogp()
    if ( ! is_page_template( 'your-template-name' ) )

    $page = get_post( $GLOBALS['post'] );

    // Inspect the page meta data to find the taxonomy and the images.
    // print the OGP data

share|improve this answer
Thanks Toscho! This are good news! I will try something here. – Diana Jul 15 '12 at 17:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.