Skip to main content

Posts

Showing posts from January, 2014

email notification publish post in wordpress

email notification publish post in wordpress publish post to send mail users in wordpress function email_me($post)  { global $post; global $wpdb; /*author*/    $user_id = $post->post_author;    $table_name = $wpdb->prefix . "subscribe_users";    //$emails = $wpdb->get_results($wpdb->prepare( "SELECT subscriber_email FROM $table_name WHERE status = %s AND author_id = %d",'active',$user_id));    $emails = $wpdb->get_results($wpdb->prepare( "SELECT subscriber_email FROM $table_name WHERE author_id = %d AND status = %s",$user_id,'active'));   foreach($emails as $email) {     $postMessage = $post->post_title;     wp_mail($email->subscriber_email, "Blog Post", $postMessage); }     return $post; } add_action ( 'publish_post', 'email_me' ); 

wordpress insert meta key and value query

wordpress insert meta key and value query wordpress insert meta key and value query $metakey = "_metakey"; $metavalue = $metakey_val; $post_id= $post_id; $wpdb->query( $wpdb->prepare(  " INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value ) VALUES ( %d, %s, %s ) ",          $post_id,  $metakey,  $metavalue  ) );

wordpress update query

wordpress update query  update the postmeta values in wordpress $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = $total_ban_pric1 WHERE post_id = $post_id_totalcall AND meta_key = '_sale_price' ");

How To Get The Custom Post Type Image URL in Wordpress

How To Get The Custom Post Type  Image URL in Wordpress How To Get The Custom Post Type  Image URL in Wordpress <?php $catquery = new WP_Query( 'posts_per_page=8&post_type=homepageimages' ); while($catquery->have_posts()) : $catquery->the_post(); $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?> <li> <a href="<?php echo post_permalink($post->ID); ?> "><img src="<?php echo $url; ?>" alt="Banners" class="panelImg" data-src-active="/data/text/promos/banners-vertical.jpg"></a> <?php the_content(); ?> </li> <?php endwhile; ?> 

How To Get The Custom Post Type Content in Wordpress

How To Get The Custom Post Type Content in Wordpress How To Get The Custom Post Type Content in Wordpress <?php $catquery = new WP_Query( 'posts_per_page=8&post_type=homepage' ); while($catquery->have_posts()) : $catquery->the_post(); $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?> <li> <a href="<?php echo post_permalink($post->ID); ?> "><img src="<?php echo $url; ?>" alt="Banners" class="panelImg" data-src-active="/data/text/promos/banners-vertical.jpg"></a> <?php the_content(); ?> </li> <?php endwhile; ?> 

How to get the custom post type content in wordpress

How to get the custom post type content in wordpress   <?php $wp_query= null; $wp_query = new WP_Query(); $args = array( 'post_type' => 'testimonial', 'showposts' => '2', ); $wp_query->query( $args ); ?> <?php if ( $wp_query->have_posts() ) : ?> <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <!-- Output testimonial here --> <div class="testimonial_content"> <?php the_content (); ?> </div> <?php endwhile; ?> <?php endif; ?>