Tag Archives: array

Send email on multypal email address

$multiple_to_recipients = array(
$to,
‘raviradadiya.ommune@gmail.com’
);
wp_mail( $multiple_to_recipients, $sbj, $msg, $headers );

Post by custom days

You can also use day, week, month, year in  (1 week ago)

$last_week_news = new WP_Query( array(
‘date_query’ => array(
array(
‘after’ => ‘1 week ago’,
),
),
‘posts_per_page’ => 5,
));
$query = new WP_Query( $last_week_news );

Display post by category

<?php
$args=array(
  'cat' => 3,
  'post_type' => 'post',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
  echo 'List of Posts';
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
 <?php echo the_title(); ?>
    <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to 
<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>

display metabox with array

<?php
$my_query = new WP_Query(‘post_type=listing&posts_per_page=-1’);

/* bathrooms */
$bathrooms=array();
while ($my_query->have_posts()) : $my_query->the_post();
$bathrooms_val =  get_post_meta($post->ID, “_listingpress_bathrooms”,true);
if(!empty($bathrooms_val))
{
$bathrooms[]=$bathrooms_val;
}
endwhile;  wp_reset_query();

$final_bathrooms= array_unique($bathrooms,SORT_REGULAR);

sort($final_bathrooms);
?><select value=””><option>Badroom</option><?php
foreach($final_bathrooms as $bathroom)
{
?><option value=”<?php $bathroom; ?>”><?php echo $bathroom; ?></option><?php
}
?></select>

Display user meta

also watch:
http://codex.wordpress.org/Function_Reference/get_the_author_meta

global $wpdb;

$argsa =array( ‘role’ => ‘aamrole_53673234ba574 ‘ );
$a = get_users( $argsa );
$argsb =array( ‘role’ => ‘ aamrole_5329589cf0296 ‘ );
$b = get_users( $argsb );
$agentusers = array_merge( $a, $b );
#print_r($agentusers);
foreach($agentusers as $agentuser)
{
?>
<div class=”agent-detail”>

<div class=”box” style=”margin-bottom:20px;”>
<h6 class=”service-title”><div class=”img” style=”height=100%; width:20%; float:left;”><?php echo  get_avatar( $agentuser->user_email); ?></div>Agent: <?php echo $agentuser->nickname; ?></h6>
<h6 class=”service-title”>Location: <?php echo $agentuser->location; ?></h6>
<h6 class=”service-title”>Email: <?php echo $agentuser->user_email; ?></h6>
</div>
</div>
<?php
}
?>

%d bloggers like this: