Spit out list of distinct instances of custom field?

Here’s a dashboard widget you could manage them with: // add dashboard widget add_action(‘wp_dashboard_setup’, ‘wpse_dashboard_widget’); function wpse_dashboard_widget() { // only show widget to users who can publish pages if(current_user_can(‘publish_pages’)) { wp_add_dashboard_widget(‘deduped_dash_widget’, ‘Publications’, ‘wpse_create_deduped_dash_widget’); } } // widget contents function wpse_create_deduped_dash_widget() { // select publications without duplicates by using DISTINCT global $wpdb; $mentions = $wpdb->get_results(“SELECT DISTINCT … Read more

Change blog post title on main blog page

First of all, yes, its seems to be the right place to look. get_the_ID() gives you the ID of the current item in the loop. Do you have the custom field so far? If yes you can output the “Custom field – Title” with this lines of code: $customTitle = get_post_meta( get_the_ID(), ‘CustomFieldSlug’, true ); … Read more

query_posts -> get page_id from custom field

You get a custom field by using get_post_meta: <?php $pageID = get_post_meta( get_the_ID(), ‘custom_field_name’, true ); ?> You can then use that for the query you need, but you should not use query_posts, this function overrides the main query and isn’t normally used on themes or plugins, it should be avoided. This can increase page … Read more

WooCommerce 3 get custom variation on process order [closed]

Okay I find solution for this one!! Add field to the each product variation with this one github Remi Corson And because I have a custom gateway plugin for WooCommerce I found there where products are initiated and use foreach to get ‘productId’ for each product. There I use $variation = $item[‘variation_id’]; $productVariation = get_post_custom($variation); … Read more

Create Shortcode shows only posts with custom_field meta

You need your shortcode to accept attributes. A shortcode with attributes would look like: [publication year=”2017″] Then in your add_shortcode callback function you receive attributes in the first parameter of the function: function wpse_279094_publication_shortcode( $atts ) { echo $atts[‘year’]; } add_shortcode( ‘publication’, ‘wpse_279094_shortcode’ ); You want to be able to account for a user not … Read more

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