Paying to Access Custom Fields Per Post

This sounds like custom development work, I doubt there is a pre-built solution. At its most basic, I’d say you need to a membership solution. There are a several out there, some free, some premium. Then in your front-end you can wrap the display of all the custom fields with current_user_can() using a capability that … Read more

Add custom field to post with some part of url as value

I found this solution, it works great. I will share it here if someone else need it. $currenturl=”http://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]; $id = $post->ID; if ( preg_match(‘/\?(.+)$/’, $currenturl, $matches) ) { $value = urldecode($matches[1]); add_post_meta($id, ‘my_new_custom_field_name’, $value, true); }

Unable to get the upcoming events for custom post

just changed the query a little $meta_query_args=array( ‘relation’ => ‘AND’, array( ‘key’ => ‘event-start-date’, ‘value’ => $date_today, ‘compare’ => ‘<‘, ) ); $loop = new WP_Query( array( ‘post_type’ => ‘events’, ‘posts_per_page’ => 5 , ‘meta_key’ => ‘event-start-date’, ‘orderby’ => ‘event-start-date’, ‘order’=>’desc’, ‘meta_query’ => $meta_query_args ) ); if($loop->have_posts()): while ( $loop->have_posts() ) : $loop->the_post(); but can … Read more

new WP_query using custom fields

This is what works in my query: <?php $argsfeature = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’, ‘order’ => ‘DESC’, ‘posts_per_page’ => ‘1’, ‘meta_key’ => ‘featuring’, ‘meta_value’ => ‘1’ ); ?> and this query works: <?php $argsarticles = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’, ‘order’ => ‘DESC’, ‘posts_per_page’ => ‘5’, ‘post_parent__in’ => array(10,11) ); … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)