How can I use a file in my plugin as a replacement for single.php on custom-post-type query?

The way I handle these is to store to use template_include to conditionally pass my plug-in template. One of these conditions is that the corresponding file hasn’t already been found by WordPress (i.e. isn’t present in the theme folder). This means that users can over-ride the plug-in template with a theme-specific one by simply creating … Read more

How do I create a Client Logos section in admin menu?

This would probably best be solved with a custom post type for the Exhibit. That will give you a new section in the admin-area with posts/pages for each exhibitor. That way you can for example use: Post thumbnail as “exhibitor_logo_img” The post title as “exhibitor_title” The content area as “exhibitor_bio” And if you need the … Read more

Retrieving links and names of images from a NextGEN gallery [closed]

Ok, this has worked for me. <?php // get the track list global $nggdb; $gallery = $nggdb->get_gallery ($galleryID, ‘sortorder’, ‘ASC’, true, 0, 0); ?> <div id=”tracklist”> <?php foreach($gallery as $image) { ?> <div class=”single_image” id=”image-<?php echo $image->pid; ?>”> <a href=”https://wordpress.stackexchange.com/questions/75475/<?php the_permalink() ?>&pid=<?php echo $image->pid;?>” title=”<?php echo $image->title; ?>”> <?php echo $image->alttext; ?> </a> </div> <?php … Read more

Problem since update 3.5 [duplicate]

Short explanation The $wpdb->prepare() method works similar to sprintf()/printf() and therefore needs more than one argument (else it’s senseless to use it at all). So if one of your plugins or the theme makes a DB call, which is prepared to protect you against cross script attacks and similar and doesn’t do it properly, WordPress … Read more

How do I enforce users to fill a determined custom field using WyPiekacz?

I have no experience with this plugin. But when I look at the source, I think something like this should do it: add_filter( ‘wypiekacz_check_post’, ‘wpse_78395check’ ); function wpse_78395check( $errors ) { if ( empty ( $_POST[‘custom_field_name’] ) ) $errors[] = array ( ‘unique_error_key’, __( ‘Custom error message’, ‘your_textdomain’ ) ); return $errors; } Replace all … Read more

get main product category list woocommerce

Check the parent of each category, top-level terms will have a parent value of 0: $product_category = wp_get_post_terms( $post->ID, ‘product_cat’ ); foreach( $product_category as $cat ): if( 0 == $cat->parent ) echo $cat->name; endforeach;