unnecessary request call for js and css after calling wp_dequeue_script
The hook to use is wp_enqueue_scripts instead of wp_print_scripts
The hook to use is wp_enqueue_scripts instead of wp_print_scripts
function custom_function_redirect() { if ( isset( $_GET[ ‘link’ ] ) && $_GET[ ‘link’ ] != ” ) { wp_redirect( $_GET[ ‘link’ ], 301 ); }else{ die(‘test’); } } add_action(‘template_redirect’,’custom_function_redirect’); Try this it worked for me. For redirection you should hook the function in template_redirect
When you are concatenating string you shouldn’t use ;after the method. Also you should close que quotes, call the method, and open again. Try the code below: $listItem .= ‘<div id=”agenda-block-image-responsive” style=”‘ .get_field(‘speaker-img’ ) . ‘”>’;
Sure. In your single.php or where you loop through the posts, start by getting the content: $content = get_the_content(); Then use a regex where you target anything within <h2> tags: $regex = ‘/<h2>(.*?)\<\/h2>/u’; And then use preg_match_all() to find all titles: preg_match_all($regex, $content, $table_of_content); This will create a multidimensional array, see: print_r($table_of_content); So you have … Read more
As I understand your question, you want to Update a GF field with the results ($distance) of an AJAX request. If that is correct, on a successful AJAX request, you just need to update the value of your GF field. Assuming your response is the actual value correctly formatted. here’s what you need to do. … Read more
If you want them in an unordered list: echo “<ul>\r\n”; foreach ( $submenu as $group => $item ) { foreach ( $submenu[$group] as $key => $value ) { echo “<li>” . $submenu[$group][$key][0] . ” > ” . $submenu[$group][$key][2] . “</li>\r\n”; } } echo “</ul>”; This results in: <ul> <li>Home > index.php</li> <li>Updates > update-core.php</li> <li>Library … Read more
good question! Basically, in your enqueue you call the Parent stylesheet first then the child, so any child styles (by definition of css specificity) will override the parent styles. Code example from the WordPress codex: https://codex.wordpress.org/Child_Themes <?php function my_theme_enqueue_styles() { $parent_style=”parent-style”; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ … Read more
Just add your functions to your theme’s functions.php file. They will be available to all of the templates within the theme. functions.php: function add_cars_specifications() { if ( in_category( ‘cars’ ) ) { echo types_render_field( ‘cars-specs’, array() ); } } In your page template file and other templates in the theme, add_cars_specifications() will be in scope, … Read more
I’m not sure Why you used loop to display your post meta. and you code are all ok but you have to change little-bit. Q. Why you used inline script ? On my opinion you should used external script file to do this. anyway that’s not the main issue here. In order to work with … Read more
wp_nonce_field() will echo its output by default, so set the $echo parameter to false: add_shortcode(‘signup_form’, ‘get_signup_form’); function get_signup_form() { $wp_nonce_code = wp_nonce_field( -1, ‘_wpnonce’, true, false ); $signup_form_code = <<<EOT <form method=”post” class=”popup-register” action=”/my-account/”> <p style=”text-align:center;”> <input type=”email” class=”popup-input” style=”width: 65%;” name=”email” id=”reg_email” placeholder=”Enter your email address”> <input type=”submit” class=”popup-input-submit button” style=”margin: 0; border: 1px … Read more