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

WordPress child theme fails to override parent navigation menu in /inc/structure/header.php

You need to copy to your child and edit the function where the file is included, probably ´shop_isle_primary_navigation´, to change the path where the file is located. WordPress only loads automatically from child the default files, that’s the ones defined in template hierarchy. You can read more about this at https://developer.wordpress.org/themes/basics/template-hierarchy/

database interactions using OOP

This is potentially a fairly involved question, so I may not be totally rigorous in my answer, but this should give you a good start when creating and deleting tables.. Include the following lines in your plugin _construct() function of class_my_plugin.php: if (is_admin()){ //manage the the database tables when registering or deactivating register_activation_hook($loc, array($this, ‘your_plugin_installation’)); … Read more

Can’t get page content in WordPress

Wrap the_content() function like below $args = array( ‘post_type’ => ‘your-custom-post-type’, ); $query = new WP_Query( $args ); while( $query->have_posts() ): $query->the_post(); the_content(); endwhile; wp_reset_postdata(); one thing to note here though, you must know where to end the loop ( i.e., endwhile; ) as you’ve other markup in the page template ( I assumed that … Read more

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts

Or is it because im trying to add it to the css class .has-post-thumbnail which is applied to all posts? Yes, set_featured_background() gets first post from the loop and add .has-post-thumbnail to styles. All posts that have thumbnail (with class .has-post-thumbnail) will have the same background. Try setting the background in the template file responsible … Read more