Trying To Call a Dynamic Email Address

Assuming this page belongs to an agent: <p> <i class=”fa fa-envelope-o”></i> <span style=”font-size:11px”><?php echo get_the_author_meta( ‘user_email’ ); ?></span> </p> Assuming this page does not belong to the agent, but the email is stored in the page’s custom field named, for example, agent_email: <p> <i class=”fa fa-envelope-o”></i> <span style=”font-size:11px”><?php echo get_post_meta( get_the_ID(), ‘agent_email’, true ); ?></span> … Read more

Search function not working

Header <form> don’t have action=”” attribute. So basically what form do, when you search, is append s=keyWord in current url, that is why you have url like this https://techcart.pk/product/8mm-led-10pcs/?s=abc. What you need to to is to add action=”” in <form>. You can inspect element in sidebar search field and you can see this markup: <form … Read more

wordpress query returning unexpected results

First thing first, mind your formatting. Future you thanks you! Second, you’ve just got some weird array sticking around in your $args variable. I believe what you’re looking for is meta_query which takes “an array of arrays” to compare by. Third I believe you’re also looking for posts_per_page, not numberposts. posts_per_page is the record limiting … Read more

Creating a WordPress addon for ContactForm7 submission (.XML file export)

The file is not created, because the function my_generate_xml exists, but is never called. All that code looks correct. The only problem is that you have to call the function that generates the XML file… add_action(‘wpcf7_before_send_mail’, ‘my_get_form_values’); function my_get_form_values($contact_form) { // get info about the form and current submission instance $formTitle = $contact_form->title(); $submission = … Read more

How to update option field in database on clicking the publish button in customizer

When ‘publish’ is clicked in customizer, the option ‘theme_mods_THEMENAMED’ is updated. An function/action could be added See https://developer.wordpress.org/reference/functions/add_action/ on the wordpress actions add_option_(option_name) and update_option_(option_name) See https://codex.wordpress.org/Plugin_API/Action_Reference#Administrative_Actions. The new function could then save what ever option you want to update.