Prevent redirect to wp-login.php

I guess you don’t have code on your new login form that supports ?action=lostpassword ? Your choices are either copy the relevant code from wp-login.php to your new form; you want the retrieve_password() function. Then you can post back to /login?action=lostpassword. use your own ‘lost password’ form, but post to /wp-login.php?action=lostpassword hook the lostpassword_redirect filter … Read more

Parse error: syntax error, unexpected ‘,’

You’ve got unbalanced and improperly placed closing parenthesis. There shouldn’t be the closing parenthesis after the ‘stylesheet’. Because the closing parenthesis is there, the PHP processor thought that was the end of the function’s parameters. Which caused the comma character after that to cause the error. Watch the balancing of your parenthesis (and quotes) as … Read more

Where is the PHP code generating an element?

You can ask a dozen developers how they work with themes or plugins and you’ll get a dozen different answers. My method is to use NetBeans to edit php files stored locally on my computer and then ftp (NetBeans upload) them to a test server with wp_debug turned on. NetBeans turns the theme or plugin … Read more

Form Submission Not Working In Custom Theme

WordPress uses Name, email post fields to do post comments, If you renamed the your form elements name attributes to be f-name and f-email then your issue will be resolved. I have made changes in below code and it is working now. <?php if($_POST[‘f-submit’]) { if(!$_POST[‘f-name’]) { $error=”<br>- Please enter your name”; } if(!$_POST[‘f-email’]) { … Read more

Add class to website based on post taxonomy

You can use the body_class filter in WordPress to add the Taxonomy Terms of a Custom Taxonomy as CSS classes to a post. The CSS class appears in the body element and is only used if the post has been assigned to the taxonomy. The code goes in your functions.php file. add_filter( ‘body_class’, ‘themeprefix_add_taxonomy_class’ ); … Read more

Show icons or badges under title on product archives/category pages

So I was not able to solve my problem earlier, then I switched the plugin to “Category and Taxonomy Image” (by Aftab Hussain) and used the following code to display the icons on category/archive pages: add_action( ‘woocommerce_after_shop_loop_item’, ‘attribute_img_loop’, 20 ); function attribute_img_loop() { global $product; // Check that we got the instance of the WC_Product … Read more

How to use wordpress function wp_enqueue_script() in php?

I am wondering if that is the right way to use wp_enqueue_script() function in php. Do I need to place wp_enqueue_script() somewhere else ? Not really, here’s what the official docs say in the notes: https://developer.wordpress.org/reference/functions/wp_enqueue_script/ The function should be called using the wp_enqueue_scripts action hook if you want to call it on the front-end … Read more