how to add acf value to other plugins shortcode?
try adding quotes around the values returned by ACF: $thestore = get_field(‘store-name’); $theapp = get_field(‘app-id’); echo do_shortcode(‘[appbox “‘ . $thestore . ‘” “‘ . $theapp . ‘”]’);
try adding quotes around the values returned by ACF: $thestore = get_field(‘store-name’); $theapp = get_field(‘app-id’); echo do_shortcode(‘[appbox “‘ . $thestore . ‘” “‘ . $theapp . ‘”]’);
Can’t pick up a field created with Advanced Custom Fields
You’re on the right track. However your parameters for get_field() are incorrect in your example. The second value should be an ID or false (true is not valid): // Incorrect. Uses ‘true’ as second parameter: if ( get_field(‘logo_src’, ‘true’, $taxonomy . ‘_’ . $term_id ) ) { Try this. Use get_field() to return the value … Read more
You need to use wp_get_object_terms(). The function will get all the terms available in taxonomies based on the arguments supplied. wp_get_object_terms( get_the_ID(), ‘category’, array( ‘fields’ => ‘slug’ ) ); For more info can be found in here
Yes. You could keep other fields to specify the timestamp of the start and end dates. You then compare the timestamp on the front-end. If the current timestamp is larger than the start date and smaller than the end date, display the fields. Yes, kinda. I don’t know if there’s a straightforward way to do … Read more
Ok, I solved this with a nice function, now the only thing left to do is to find a way to update all of the blog posts. doing this by hand will be really bad here is the code that I used add_action( ‘save_post’, ‘myplugin_save_postdata’ ); function myplugin_save_postdata( $post_id ) { if ( ‘page’ == … Read more
if($search->keyword){ $project_args[‘s’] = $search->keyword; } That was the culprit. FML! Everything else was correct.
Currently from your code I can see you are looping for post IDs from 1 to 1000 that isn’t good. WordPress have lot of functions by which you can fetch post IDs, content and other information. One of them (according to your need) is get_pages() Check the documentation of get_pages() there are lot of examples. … Read more
As suggested by @Sumit, the problem was in the template: there was a test that prevented the_content() to execute when the content was empty. <?php if ( $page->post_content && have_posts() ) while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile ?>
setup_postdata()requires a post object such what you would get by using the global $post. You are using a custom field, presumably from ACF, and calling it $post. The problem is that it is not an object. You can use the field $designer in a customised post loop like so: <?php if ( have_posts() ) { … Read more