Get value of contact form 7 radio button [closed]

Depending when you’d like to take the action you should change the hook – I’ve chosen wpcf7_before_send_mail – your function function wpcf7_cstm_function($contact_form) { $title = $contact_form->title; $submission = WPCF7_Submission::get_instance(); if ($submission) { $posted_data = $submission->get_posted_data(); $txt = isset($posted_data[‘txt’])?$posted_data[‘txt’]:”; $text2 = isset($posted_data[‘txt2’])?$posted_data[‘txt2’]:”; $radio = isset($posted_data[‘radio’][0])?$posted_data[‘radio’][0]:”; // do something with your data } } add_action(“wpcf7_before_send_mail”, “wpcf7_cstm_function”); Explanation: … Read more

Show different Customizer Settings on Page-Tamplates

The customizer API offers active_callback methods on both the control andd section classes. Basically you use either an conditional or a custom function to determine if a control or section is shown to the user. If you want a section to appear only for pages, you would do somthing like this: $wp_customize->add_section( ‘wpse_283821_acme_pages’, array( ‘title’ … Read more

Can I run custom php on specific pages in wordpress?

If you are using a child or custom theme, I encourage you to look at the Codex’s Template Hierarchy. The short answer to your question is yes, you can run custom code on any page you’d like. The longer answer is still yes, but it’s a bit more involved in what your end product is … Read more

WordPress Rewrite API calls not creating new rules

Correct solution provided by Milo in comment above. Pretty permalinks were set to plain in the admin interface and this evidently causes the WP_Rewrite to silently do nothing. I’m posting the answer here so I can mark something as correct/complete so this shows as answered. Am I doing it wrong?

WP Plugin + OOP: Adding Menu Page doesn’t create required effect

the call at the anonymous function is done after all the executions of add_new_page. then you need to store all elements to create menu items. try to modify the class Helper like that public function __construct() // method to modify { add_action(“admin_menu”, [$this, “add_admin_menu_items”]); } public function add_new_page( $opt ) // method to modify { … Read more

Concatenate site_url and string doesn’t work

Without knowing exactly what you are trying to do, it seems you want to append query variables to the URL. WordPress has methods for handling that properly, without manual string concatenation. Look at the documentation for add_query_arg() for details: https://developer.wordpress.org/reference/functions/add_query_arg/ You can rebuild the URL and append query variables to the URL query by using … Read more