Sort and display pages with specific custom field (not tag)

Thanks @PieterGoosen and @realloc. I came up with this solution: Added meta_key=important&meta_value=1 in wp_list_pages(). And gonna use custom field for pages important: 1. This is for list of IMPORTANT child pages. function important_list_child_pages() { global $post; if ( is_page() && $post->post_parent ) $childpages = wp_list_pages( ‘meta_key=important&meta_value=1&sort_column=menu_order&title_li=&child_of=” . $post->post_parent . “&echo=0’ ); else $childpages = wp_list_pages( … Read more

How to put forward a blog post

You can do this with Sticky Posts feature in WordPress. When you make a post sticky, it shows up above your new posts. As name suggests, that particular post will stick at top, first in the row for as long as you want. Sticky Posts is a feature introduced with Version 2.7. A check box … Read more

Injecting pre-defined text from custom page template to editor

The code below will work, read inline comments. Paste it into your theme functions.php or plugin. The only problem with this is the it will only work when the template is selected and the post is saved/updated and the editor is blank. <?php function wpse_177576_update_editor_content( $post_id ) { if ( wp_is_post_revision( $post_id ) ) return; … Read more

ACF no print data [closed]

I assume you want the field for the current category archive, not the category of the post inside the loop? Try get_queried_object_id() instead of the_category_ID( $echo ). In single.php, you just need a slightly different iteration of your original attempt: if ( $terms = get_the_category() ) the_field( ‘bgcolor’, ‘category_’ . $terms[0]->term_id );

How to show list of posts with custom field value (a date) that are coming soon

Firstly, the_post() doesn’t actually output anything – it just sets up the post data ready to output. You’ll need to do something like this to show the posts: <?php while ( $loop->have_posts() ) : $loop->the_post(); the_title(); the_content(); endwhile; ?> There’s several more tags you can use and you’ll want to format the HTML around them … Read more

How to add a css class to custom field value?

It’s very similar to how you set / access theme options: http://codex.wordpress.org/Function_Reference/update_user_option setting: update_user_option( $user_id, $option_name, $newvalue, $global ) <- taken from wordpress codex. and getting : http://codex.wordpress.org/Function_Reference/get_user_option get_user_option(‘color_option’, $userID); To get your specific request fulfilled, you would need to find the user_option(s) and then append to the list via a plugin or theme customization