Modify arguments for parent theme’s `wp_register_style` via child theme

I don’t think there’s a built-in safe way to do this, but you could directly modify the $wp_styles global after things are registered but before they’re output, or at least use it to fetch the parameters a style was originally registered with. global $wp_styles; if( isset( $wp_styles->registered[‘a_stylesheet’] ) ){ $wp_styles->registered[‘a_stylesheet’]->args=”handheld”; } Not ideal, but it … Read more

Active class not working on custom menu link using add_menu_page

Well, it is quite a hack I propose, but I would suggest the following: add_action( ‘admin_head’, ‘chg_menu_on_special_pages_page’ ); function chg_menu_on_special_pages_page(){ global $parent_file; $gallery_page_id = 2; if( $parent_file != ‘edit.php?post_type=page’ ) return; if( ! isset( $_GET[‘post’] ) || $_GET[‘post’] != $gallery_page_id ) return; $parent_file=”post.php?post=”. $gallery_page_id .’&action=edit’; return; } By the global $parent_file it is decided, which … Read more

How I can shorten this title length?

Because this is in a plugin, you don’t actually want to directly modify the plugin file itself. If you do that, you won’t ever be able to update the plugin without overwriting your work and needing to find it and add what you did again. Instead, there’s a filter set up in the plugin for … Read more

Sum of Custom Meta written by Authour

Maybe not the most elegant solution $authorPost = get_posts(array(‘author’ => 1));foreach ($catPost as $post) { setup_postdata($post); $ids[] = get_the_ID(); } $idList = implode(“,”, $ids); //turn the array into a comma delimited list $meta_key = ‘post_view’; $allview = $wpdb->get_var($wpdb->prepare(” SELECT sum(meta_value) FROM $wpdb->postmeta WHERE meta_key = %s AND post_id in (” . $idList . “)”, $meta_key)); … Read more

How to fix blank pagination links?

Could you go to this page for us: ../wp-admin/options-permalink.php What is the structure chosen? That will give you the answer for how to adjust the function on the bottom edit: Also, Why is this part like this: if ($echo) { echo $output; } return $output; } Shouldn’t $output be in parenthesis?

Woocommerce Price Text

Just use the $product parameter to get the custom field value, and determine what to return: function custom_price_html( $price, $product ) { if ( ( int ) get_post_meta( $product->id, ‘price_per_person’, true ) ) $price .= ‘ per person’; elseif ( ( int ) get_post_meta( $product->id, ‘price_per_group’, true ) ) $price .= ‘ per group’; $price … Read more

WordPress get_post_meta issue

First you should make some improvements to your template file. Try this: <?php get_header(); ?> <?php global $woo_options; ?> <?php if ( $woo_options[‘woo_featured_disable’] <> “true” ) include( TEMPLATEPATH . ‘/includes/featured.php’); ?> <?php $args = array( ‘post_type’ => ‘infobox’, ‘order’ => ‘DESC’, // DESC for newer first. ‘orderby’ => ‘date’, ‘posts_per_page’ => 6 // For a … Read more