reusing code in function and running it with loop

You would need to set up the function like this in your functions.php function my_function(){ //your function in here include(TEMPLATEPATH . ‘[variable][1].php’); } And then in your loop you would call it like so: $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ); $featured_query = new WP_Query($args); if ($featured_query->have_posts()) { while ($featured_query->have_posts()) { $featured_query->the_post(); … Read more

How do I add functionality to images?

If you want to append HTML to images, you want to look inside the template files. Search for something like the_post_thumbnail function, and add your HTML right after the closing </a> tag (if there is one). You’d then need to style it with CSS so that it’s only visible upon hovering the image. For example, … Read more

is_preview() always return false

is_preview() should return true is it is a preview. Did you try the following on the page.php? if(is_preview()){ echo “preview” }else{ echo “no preview” } to check if the is_preview() function is working? EDIT2: You could work your way around it and check for: if($_GET[‘preview’] == true){}