Tag Info

New answers tagged

0

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; }


0

I have managed it to work i was trying not to work on with hooks like the plugin developers suggest, but the solution was with hook. Here is the documentation example of the plugin But i need to edit the content of the post too so i make a loop to find the post you can create a query to get it too it will be ok too. So i get the content like this: ...


1

All of these cost another DB Query (each!), and worse still since they are in a loop each one happens around 300 times. Don't panic! The posts from your query are stored in WordPress' object cache (which is simply memory, unless you have a custom cache system in place). All functions that operate on posts route through this cache, so in your case ...


0

If you want something to behave like a "normal" wordpress author then the best thing to do is to create a "dummy" account for it, and if you really want disable the possibility to login to it. For any other solution that mimics the functionality in other ways you first need to fully understand the functionality you are trying to mimic, and by your own words ...


0

I've managed to work around this by using Gmaps.js. function initMap($el) { var bounds = []; var waypts = []; var $markers = $($el).find('.marker'); var map = new GMaps({ div: $el, scrollwheel: false, zoomControl : true, zoomControlOpt: { style: 'LARGE', position: 'TOP_RIGHT' }, panControlOpt: { position: ...


2

You need to use the has_sub_field() method inside an if() statement. I've only included the affected code below to highlight the specific changes required. if (has_sub_field('vimeo_id')): // Added if() // ... endif; You also need to a use the get_sub_field() function here as opposed to the has_sub_field() function: <iframe ...


1

Isn't that just the regular WP loop? Don't think this is related to ACF, since as you say this distance-thing isn't a custom field and ACF is made for working with those. Not sure how you build this without seeing more code. But couldn't you go something like $post->distance ?


2

I guess it should work the way it is described in your question of default code for Advance custom fields Also as custom field are part of post you can use $post->name of custom field also.


1

Your string example is wrong. You´re ending the echo statement right after opening the <div>. It should look like this: echo '<div class="quarter"><img src="' .$image[0]. '" alt="Logo"></div>';


0

You can get a field from another post/page by using the ID from that post. Like this: <?php get_field( 'field_name', $ID ); ?> So in your case to get the image field from the previous page, you would replace $ID with $prev_post->ID and field_name with the name of your field.


0

I think he meant that the final foreach loop should look like this: <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) setup_postdata($post); ?> <li> <a href="<?php echo get_permalink( $post->ID ); ?>"> <?php echo get_the_title( $post->ID ); ?> ...


1

If you'r using ACF plugin you should look the documentation first, here's relevant ACF saves taxonomies terms meta to options table, and they can be accesed using get_field( "{$field_key}", "{$term->taxonomy}_{$term->term_id}" ); So in you'r example it would be: $image = get_field( 'featured_image', 'product-category_' . ...


-1

I used a plugin called Really Simple CSV Importer https://wordpress.org/plugins/really-simple-csv-importer/ If that link is dead, you can find it on github here: https://github.com/dansullyLT/rs-csv-importer It populated my custom fields that I made in ACF. Here is how I used it. Download the sample CSV file the plugin dev offers you. You make each ...


0

It was solved by a coworker. function removebreaks($content) { $content = str_replace('<br>', '', $content); $content = str_replace('<br/>', '', $content); $content = str_replace('<br />', '', $content); $content = str_replace('<BR>', '', $content); $content = str_replace('<BR/>', '', $content); ...


0

The Codex includes a useful page on AJAX in plugins which outlines how to send and receive an ajax request. The code below covers how you would trigger an event when the select field is changed and fire off the ajax request. Make sure you're getting and setting a nonce value. /** * Only execute after jQuery is loaded */ jQuery(document).ready(function ($) ...


0

<div class="pr_grid_cell clearfix"> <?php //for each category, show posts $categories=get_categories(); foreach($categories as $cat) { $args=array( 'post_type' => 'products', 'showposts' => -1, 'category__in' => array($cat->term_id) ); $posts = new wp_query($args); // This is the best way to if ($posts->have_posts()) while ...


0

In general, you need to pass the page ID to the_field and for that matter get_post_meta as well You can try the following the_field( 'sale_images_url', $page->ID );


0

You can print custom filed value with get_field function in ACF you can do this. Inside the loop. <?php echo get_field( 'sale_images_url' ); ?> Outside the loop. <?php echo get_field( 'sale_images_url', $page->ID ); ?> Removed get_post_meta example because as pointed out by @Milo it will not produce correct result. Thanks.



Top 50 recent answers are included