Custom url structure for custom template

In the link you attached, you have everything you need. You should: add query variable (e.g operators_actv), add rewrite rule that sets this variable (operators_actv), use the template_include action hook to load custom template if query variable operators_actv is set. Code: add_filter( ‘query_vars’, ‘se332319_custom_query_vars’ ); add_filter( ‘template_include’, ‘se332319_custom_template’, 50 ); add_action( ‘generate_rewrite_rules’, ‘se332319_resources_cpt_generating_rule’ ); function … Read more

Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint

I’m not sure why are you trying to print out a PHP file’s path, because it’s not a good practice. But to get the equivalent function for themes, you can use: For parent themes : get_template_directory_uri(); For Child themes: get_stylesheet_uri(); Both are without trailing slash. Important Note Don’t ping a PHP file directly from your … Read more

WordPress PHP plugin – Settings page error

Your form is not including any additional parameters. $_SERVER[‘PHP_SELF’] is only the file name, not the ?page=job-board/adduser.php part. The script is going precisely where you are telling it to go. You need to alter your form to push those values though. You need to include that GET component into the action attribute. But give your … Read more

Adding rich text editor to my plugin

wp_editor() outputs the textarea(html codes), so, maybe you dont need to use that in functions.php, but use inside the page’s source. (for example, in your plugin.php: <div class=”blabla> <form action=”” method=”POST”> <?php wp_editor( ‘Hi,its content’ , ‘desired_id_of_textarea’, $settings = array(‘textarea_name’=>’your_desired_name_for_$POST’) ); ?> <input type=”submit”> </form> </div> note: it may wont work for add_option function..

Add agenda items and notifications

The WordPress way to organize this is to create separate post types for the tournaments, the games, and the participants. Here is an example for the tournament post type registration: add_action( ‘wp_loaded’, function() { register_post_type( ‘tournament’, [ ‘label’ => __( ‘Tournaments’, ‘tournaments’ ), ‘labels’ => [ ‘name’ => __( ‘Tournaments’, ‘tournaments’ ), ‘singular_name’ => __( … Read more

How does WooCommerce display a custom comment_type in Comment Admin?

To answer your first question: »How does WooCommerce add the comment_type of order_note to the dropdown in Comment Administration?«. From woocommerce-admin-init.php: function woocommerce_admin_comment_types_dropdown( $types ) { $types[‘order_note’] = __( ‘Order notes’, ‘woocommerce’ ); return $types; } add_filter( ‘admin_comment_types_dropdown’, ‘woocommerce_admin_comment_types_dropdown’ ); Of course you have to do your own, to avoid conflicts, like this: add_filter( ‘admin_comment_types_dropdown’, … Read more

Add a Span Around a Product Title in WooCommerce [closed]

Here is how you do it, First remove woocommerce single title action, and create your own function to handle the title, later add back the action using your newly created function. <?php remove_action(‘woocommerce_single_product_summary’,’woocommerce_template_single_title’,5); add_action(‘woocommerce_single_product_summary’, ‘woocommerce_my_single_title’,5); if ( ! function_exists( ‘woocommerce_my_single_title’ ) ) { function woocommerce_my_single_title() { ?> <h1 itemprop=”name” class=”product_title entry-title”><span><?php the_title(); ?></span></h1> <?php } … Read more

woocomerce variations [closed]

Just to clarify, there is no limit to 50 variations for one product in Woocommerce – this is a big misunderstanding. You certainly can have way more variations than that. I have done it myself numerous times and never had a problem. For a overview concerning variations take a look at the woocommerce documentation: Product … Read more

Plugin to install a plugin

You can take a look at TGM-Plugin-Activation plugin. It should give you good starting point. As written in the documentation: TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install and even automatically activate plugins in singular … Read more