Is the syntax problematic with this PHP code for Wordpress? -


Feel like this problem is PHP syntax, but there is no luck in wordpress forums This first code block category "Posts "Makes a link for the latest post.

  & lt ;? Php $ my_query = new WP_Query ('category_name = post & showposts = 1'); ? & Gt; & Lt ;? While Php ($ my_query-> is_psoz ()): $ my_query-> The_post (); ? & Gt; & Lt; A href = "& lt ;? php the_permalink ()? & Gt;" Rel = "Bookmark" & gt; & Lt ;? Php the_title (); ? & Gt; & Lt; / A & gt; & Lt ;? Php timeline; ? & Gt;  

This next code block should display custom field data for the latest posts in "posts", with the key of the "quad" custom field. But it is not and it does not show anything.

  & lt ;? Php $ my_query = New WP_Query ('category_name = post & showposts = 1'); ? & Gt; & Lt ;? While Php ($ my_query-> is_psoz ()): $ my_query-> The_post (); ? & Gt; & Lt ;? Php echo get_post_meta ($ post-> ID, "qanda", $ single = true); ? & Gt; & Lt ;? Php timeline; ? & Gt;  

Thanks, Mark

Rename your second query Try, otherwise Wordpress thinks it has already been done

   ID, "qanda", true); Endwhile; ? & Gt;  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -