how to load custom single.php?
how to load custom single.php?
how to load custom single.php?
I achieved this recently with the following code in archive.php add_action(‘genesis_loop’, ‘blah_search_results’); function blah_search_results() { while (have_posts()) : the_post(); if (is_category(‘in-the-news’)) { // Get article URL $article_url = get_field(‘original_article_url’); // rest of theme goes here } endwhile; }
Get post id of permalink for a specific custom post type?
The first version of my answer was that in general you would have to code that information yourself into the meta key itself. For example: booking_date booking_text booking_number But then I noticed the ACF tag of your question. If you have a custom field key price, then it’s ACF field key is saved to the … Read more
You can do it by using explode() function: $string = ‘http://domain.com/106.jpg,http://domain.com/109.jpg,http://domain.com/112.jpg’; $split = explode ( ‘,’, $string ); It will return an array. So you can print this way: echo $split[0]; //will print http://domain.com/106.jpg echo $split[1]; //will print http://domain.com/109.jpg //and so on
using ACF datepicker to filter posts on a page
Now with the new information I would go with this: ?> <form method=”post” action=”where_ever_you_want_to_point_the_user_afterwards.php”> /* The loop: */ if (the_field(‘departures’) == ‘user_departure_location’) { <input type=”radio” name=”destination” value=”<?php echo the_field(‘destination’); ?>”> <a href=”https://wordpress.stackexchange.com/questions/154925/<?php the_permalink(); ?>”> Destination: <?php the_field(‘destination’); ?> Departing from:<?php the_field(‘departures’); ?> Price:<?php the_field(‘price’); ?> </a> } /* The loop end */ ?></form> And then … Read more
Run function after post is updated
You can only sort on 1 meta value. A few posts (including this SE answer) suggest adding a filter to change the order. Add a function to your theme’s function.php file that will replace the sort order: function change_sort_order( $orderby ) { return str_replace(‘wp_posts.post_date’, ‘mt2.meta_value, mt1.meta_value’, $orderby); } Then use it where you want. Make … Read more
I believe you are on the right track with your second idea there, but you have some syntax errors with your conditional. In PHP all of your logic should be wrapped inside one set of ( ) for your conditional. Try this: <?php if ( get_field(‘website’) || get_field(’emailaddress’) ) { ?> <footer> <?php if ( … Read more