Tag Info

Hot answers tagged

4

You should be able to get the current logged in user ID and then use pre_get_posts to alter the main query on the home/blog page to only show posts from that specific user. As I understand, you are talking specifically about authors. You might want to also check the user's capabilities as well as simple subscribers won't see any posts on the blog/homepage ...


2

I hate OOP mixed in the functional structure of wordpress (here come the downvotes.....). If you use OOP just for name spacing then just use the name spacing feature of PHP, putting function in a class is just a very small part of what OOP should be. Anyway, your problems is that a there are only two way to refere to an class method, either when it is ...


2

If you're only managing a few sites and you're comfortable with the command line, you might want to look into wp-cli. With a little bit of scripting you can SSH into a remote server and do all manner of stuff like: Enable plugins: wp plugin activate acf-pro gravityforms wordpress-seo Check the versions, activation and update availability: wp plugin status ...


2

register_activation_hook is one-time only activation hook. It can be used for database structure creation, as example, that needs to fire only on plugin activation trigger. In order to set a custom taxonomy you need a hook that will fire not just once, but per every WordPress load. Such as init. Use add_action( 'init', 'YOUR_CALLBACK' ); to achieve that


2

You need to allow the content attribute of a meta tag to contain a shortcode, eg in your "functions.php" add: add_filter( 'wp_kses_allowed_html', function ( $allowedposttags, $context ) { if ( $context == 'post' ) { $allowedposttags['meta']['content'] = 1; } return $allowedposttags; }, 10, 2 ); and then your original (without the ...


2

Nice sleuthing. Every single person on this SO site has been foiled by something exactly like this at one point or another with the WordPress template hierarchy. You might think of this backwards though. All the steps you found lead you back to the shortcode [pmpro_account] which gets output in the loop-myaccount.php by way of the_content(). That ...


2

Yes it is possible, but there isn't much point in that. The crudest way is to use a filter on the result of getting the 'rewrite_rules' option, and manipulating it by adding the entries you require directly to the array, and then you might need to filter those rules out when the option is updated. The thing is that it is most likely a waste of time as as in ...


1

May be you have just enabled the 'Enable shipping' from shipping options page(Woocommerce -> Settings -> Shipping ). You need to enable the Shipping Methods also. For enabling shipping methods click on shipping method name from shipping methods table displayed on shipping options page. Check the checkbox ' Enable this shipping method ' and save the ...


1

I learned from the comments by @Pieter Goosen and @Ignat.B, and @Pieter Goosen's answer here, that I need to register the taxonomy on plugin activation, and insert the term. Then I need to hook the taxonomy registration code to the init action hook as suggested by the codex. This will ensure that when I insert the term on plugin activation, I have the ...


1

The earliest safe hook to get post information is the template_redirect hook. All the hooks in question runs before Wordpress has setup postdata, so any post info are still unavailable at that point. The globals like $wp_query and $post will still contain no data, that is why your efforts returns nothing. EDIT Extra info as per comment by @TheDeadMedic ...


1

Use php dot notation. Try: $my_templates = get_stylesheet_directory() . '/lp/'; $base = array( trailingslashit(get_template_directory()), $my_templates );


1

If you dont want 'TopLevel' menu to represent a custom page you can use: add_menu_page( 'TopLevel', 'TopLevel', 'MENU_CAP_LVL', 'MENU_SLUG', 'MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu', 'SubMenu', 'MENU_CAP_LVL', 'SUB_MENU_SLUG', 'SUB_MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu-A', 'SubMenu-A', 'MENU_CAP_LVL', 'SUB_MENU_A_SLUG', ...


1

The only 100% way to get a paid subscription kind of service working is to move part of the functionality to an external server which is under your control and manage payment, expiry, etc there. When the code is not under your control you can not limit its use, this is a very basic life fact of software development, especially when the source code can be ...


1

It's a css issue. You need to edit two selectors. First is the menu width. It's set to 100% which is why you're seeing black space. Edit this class below.: .cap-primary-menu .menu > li.menu-full-width .cap-submenu-ddown { padding: 20px 25px 25px; width: 100%; // set this to auto or something smaller than 100% left: 0; border: 1px solid ...



Only top voted, non community-wiki answers of a minimum length are eligible