Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’

Luckily, I was facing the same issue an hour ago so I brainstormed for a long time to find a find a solution. I posted it here before seeing this: http://www.hardeepasrani.com/2015/12/using-postmessage-transport-method-for-header-image/ So instead of just using: $wp_customize->get_setting( ‘header_image’ )->transport=”postMessage”; I used: $wp_customize->get_setting( ‘header_image’ )->transport=”postMessage”; $wp_customize->get_setting( ‘header_image_data’ )->transport=”postMessage”; After that, in JS, we got the value … Read more

Adding HTML within an image title attribute

First of all i’d recommend you stop using title attribute for html container purpose: Image title (and the element name speaks for itself) should provide additional information and follow the rules of the regular title: it should be relevant, short, catchy, and concise (a title “offers advisory information about the element for which it is … Read more

Landing / Static HTML page

Just name the landing page file index.html and place it (and any assets) in the root directory, then add this to your .htaccess (assuming you’re using Apache): DirectoryIndex index.html index.php When accessing http://example.com, Apache will serve index.html. WordPress will scoop up all other requests with it’s rewrite rules.

How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”

To remove the profile picture row of the table (which includes the gravatar link): jQuery( “tr.user-profile-picture” ).remove(); To remove that entire “about yourself” table: jQuery( “tr.user-profile-picture” ).parents(“table:first”).remove(); Use this type of jQuery call, don’t try to get fancy with the loop. This is on WP 4.4; earlier versions may have different HTML class names for … Read more

How to customize search result page title?

Within the wp_get_document_title() function we have: // If it’s a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: search phrase */ $title[‘title’] = sprintf( __( ‘Search Results for “%s”’ ), get_search_query() ); so you could hook into the document_title_parts filter to adjust it to your neds. Example: … Read more

Trash bin for categories

This would be quite challenging to implement. Posts can be trashed because: They have a concept of status and corresponding field in database table WordPress code “knows” to only deal with posts of appropriate status for most purposes This solves issues of visibility (posts won’t appear on front end) and interaction (trashed posts won’t show … Read more

Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?

Default attributes of WooCommerce variable products are stored as post meta in the database. You can find them in the wp_postmeta table, where the post_id column is the post ID of the parent product (Variable product), and the meta_key column is _default_attributes. You can clear and remove default attributes of all products by replacing all … Read more

Custom post type column which compares dates?

I solved it: if ( ‘visitor_active’ == $column_name ) { $start_date = get_post_meta( $post_id, ‘visitor-start-date’, true ); $end_date = get_post_meta( $post_id, ‘visitor-end-date’, true ); $current_time = current_time( ‘timestamp’ ); if ($start_date < $current_time && $end_date > $current_time) { echo ‘<span class=”dashicons dashicons-yes” style=”color:#75c377;”></span>’; } else { echo ‘<span class=”dashicons dashicons-no” style=”color:lightgray;”></span>’; } } Don’t know … Read more