Ajax filter with loadmore button

You could possibly look at doing this the same way that WP Job Manager does: https://github.com/Automattic/WP-Job-Manager/blob/master/assets/js/ajax-filters.js This is done by triggering a handler to make the query defining what “page” the query should run against. I would recommend using that as an example to build off of, as it works with both filters applied and … Read more

How to display acf field values from home page on all pages?

ACF’s the_field() and get_field() accept several parameters, one of which is a post ID. So, you just need to get the ID of the page the field is on, like this: <?php $frontpage_id = get_option( ‘page_on_front’ ); the_field(‘contact_form_title’, $frontpage_id); // For pages other than home $page = get_page_by_path(‘some-page-slug’); the_field(‘contact_form_title’, $page->ID); ?>

Apply function.php filter only if url not has /amp/

What is amp? Is it tag or category or page? You should use standard wordpress functions like is_page() is_category() is_tag(). You can also use $wp->request. It will return the request URI. If the address is “http://example.com/slug1/slug2” it will return slug1/slug2 then use explode() function to split it. <?php $uri = $wp->request; $slugs = explode(“/”,$uri);//variable $slugs … Read more

Use CSS tag inside PHP code

I’m not sure if you can add styles in filters. I tested the below code in wp_head action and worked perfectly: function show_outlet_msg(){ $term = get_term( 40, ‘product_cat’ ); $total_products=$term->count; if ($total_products>0){ $html=”<style> #txt_outlet_zero{ display: none; } </style>”; } else { $html=”<style> #txt_outlet_head{ display: none; } </style>”; } echo $html; } add_action(‘wp_head’,’show_outlet_msg’);