How to add just one specific page to widget without plugin?

Follow this step for Only one page add custom sidebar Step 1: Put this code in your theme function.php file. Register custom sidebar and your custom add_action. function wpdocs_theme_slug_widgets_init() { register_sidebar( array( ‘name’ => __( ‘Custom Sidebar’, ‘textdomain’ ), ‘id’ => ‘sidebar-10’, ‘description’ => __( ‘Widgets in this area will be shown on all posts … Read more

Download any file after submitting a form [closed]

You can use “actions”. More info: http://hookr.io/actions/wpcf7_mail_sent/ Put this code in your functions.php: function action_wpcf7_mail_sent( $contact_form ) { // here your file redirect header(“Location: http://yourfileurl.com”); }; add_action( ‘wpcf7_mail_sent’, ‘action_wpcf7_mail_sent’, 10, 1 ); let me you if it is working i cannot test right now.

get_posts of Custom Post Type AND Custom Taxonomy

You use multiple taxonomies at once, so use’relation’ => ‘AND’: <?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘products’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, // this is what was missing array( ‘taxonomy’ => ‘subjects’, ‘field’ => ‘name’, ‘terms’ => $shortcode_atts[‘subject’], ), array( ‘taxonomy’ => ‘plans’, ‘field’ => ‘name’, ‘terms’ => … Read more

ACF page while loop breaks footer while loop

Looks like you need to add ‘option’ to your footer the_sub_field() calls: <p><a href=”https://wordpress.stackexchange.com/questions/307577/<?php the_sub_field(“footer_link’, ‘option’); ?>”><?php the_sub_field(‘footer_link_name’, ‘option’); ?></a></p> var_dump() is used to dump a variable, not a string, so you would need to do something like var_dump($test) for that line to work. You are probably getting errors and warnings in your PHP log … Read more

How to load a template-part based on a url wildcard?

I ended up with this solution in functions.php, thanks to the offical WordPress documentation at: https://codex.wordpress.org/Rewrite_API/add_rewrite_rule First added a custom rewrite rule like so: function custom_rewrite_rule() { add_rewrite_rule( ‘^agenda/([^/]*)/([^/]*)/?’, ‘index.php?page_id=10&agenda_id=$matches[1]&agenda_name=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘custom_rewrite_rule’, 10, 0 ); Then this needed to be added: function prefix_register_query_var( $vars ) { $vars[] = ‘agenda_id’; $vars[] = … Read more

Way to querry data (tags) from a wordpress database?

Looking at your page the content is empty. <div class=”post_tags”></div> It seems you aren’t inserting that PHP code correctly into your page. To do so you have to two options: Without using a plugin. Add the following code in your functions.php function list_all_tags( $atts ) { $tags = get_tags(); $html=”<div class=”post_tags”>”; foreach ( $tags as … Read more

How can I add multiple ‘tax_query’ arrays via a loop?

OK, I have no idea how and why your code should work… It has nothing in common with correct PHP syntax… But it’s pretty good pseudo-code, so I think I can guess, what you wanted to achieve… $tax_query = array(); if ( have_rows(‘category_taxonomies’) ) { while ( have_rows(‘category_taxonomies’) ) { the_row(); $tax_query[] = array( ‘taxonomy’ … Read more

Pagination for custom php code

<?php $pod = pods( ‘my_pod’ ); $params = array( ‘limit’ => 15 ); $pod->find( $params ); // Advanced Pagination echo $pod->pagination( array( ‘type’ => ‘advanced’ ) ); // Simple Pagination echo $pod->pagination( array( ‘type’ => ‘simple’ ) ); // Paginate echo $pod->pagination( array( ‘type’ => ‘paginate’ ) ); ?> From Pods documentation.