How to display custom post type ordered by a custom field date

The correct array key to use is meta_key, not key. You can only use key as part of a meta_query subarray, where the ‘meta’ part is implied. This is all described in the codex. Try <?php $activities = new WP_Query( array( ‘post_type’ => ‘timeline’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘activity-date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => … Read more

predefined custom field on registration page

Find <div id=tab2_login” and replace it with following code.Assuming you will change CSS and JS accordingly. <div id=”tab2_login” class=”tab_content_login” style=”display:none;”> <h3>Register for this site!</h3> <p>Sign up now for the good stuff.</p> <form method=”post” action=”<?php echo site_url(‘wp-login.php?action=register’, ‘login_post’) ?>” class=”wp-user-form”> <div class=”username”> <label for=”user_login”><?php _e(‘Username’); ?>: </label> <input type=”text” name=”user_login” value=”<?php echo esc_attr(stripslashes($user_login)); ?>” size=”20″ id=”user_login” … Read more

Function not pulling image or text from custom post type

Try this way, may help you. I just fetch from a specific post ‘s image from a specific Post Type called “gameshowwarriorsw”. $gameShowWarriorsWorld = new WP_Query( ‘post_type=gameshowwarriorsw&orderby=date&order=DESC&p=371’ ); while ($gameShowWarriorsWorld->have_posts()) : $gameShowWarriorsWorld->the_post(); $postTitle = get_the_title(); $postid = get_the_id(); $postContent = get_the_content(); ?> <li> <a href=”#” onclick=”return get_inzenwarriorhero(<?php echo $postid ; ?>);”> <?php the_post_thumbnail(array(219,143)); ?> </a> … Read more

How do I display posts with specific value in a custom field into my loop?

Use the meta_query argument of WP_Query. For example, if your custom field name is “year” and you want to get the post with year=2013: <?php $loop = new WP_Query( array( ‘post_type’ => ‘Sport’, ‘posts_per_page’ => 3, ‘meta_query’ => array( ‘meta_key’ => ‘year_comm’, ‘meta_value’ => ‘2013’, //Assuming you are using numeric value //if not, delete the … Read more