Adding theme strings to .PO file

Nevermind, I figured out the solution: the trouble was that POEdit hadn’t picked that there were both singular and plural forms, so I had to manually edit the .PE file to this: msgid “Job Posted” msgid_plural “Jobs Posted” msgstr[0] “” msgstr[1] “”

Cannot access variables within a widget

This is more of a pure PHP than WordPress. You are implicitly creating $ranNum as local variable in function scope. $Example_Widget won’t access widget instance in PHP. What you should be using is $this->ranNum, for reading and writing. That will create object’s property implicitly, but you likely should declare it explicitly in your class definition … Read more

WordPress Rewrite Issue

The rewrite rules are wrong. For example, you want to rewrite from community/tag/easter to ‘index.php?pagename=community&stencil-tag=easter’, so the regex should contain community/tag/ and not only tag/. Also, \d match only digits but the tag value is a string. Same apply to the rewrite for stencil-tag. You could use . to match any character, both numeric and … Read more

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

Woocommerce: deleted single-product.php, everything still works. How is it possible?

Themes can override WooCommerce default template pages, to customize the appearance of those pages easily. There should be a folder within your theme folder called woocommerce. WooCommerce checks for template files within that folder first. If a file doesn’t exist there, it loads it’s own template file. Edit: If you want to customize those pages, … 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