A couple of things, if you want multi-select then you have to use Checkbox, Radio Buttons are never multi-select.
It looks like you need to get_post
before you call your query. If you visit the Checkbox documentation and review the Query Posts section you will see the code you need. https://www.advancedcustomfields.com/resources/checkbox/
The values in a Link you set when you create the link and there is no way to get the featured image.
If you are trying to get that information you should look into using Relationship
https://www.advancedcustomfields.com/resources/relationship/
Hi GusGF,
I’ve used date formatting like this:
$startmulti = get_sub_field('start_date_1', false, false);
$startmulti = new DateTime($startmulti);
and then in then in my output
$startmulti->format('F j')
This has always worked for me to set the format of the datepicker.
Hi toniolivier,
If you do a quick test we can see what is going on. Create a custom field “Name” and have it show up on a Page(s).
Then create a page and fill in the Name field and in the content area add your shortcode, using the shortcode block. Does the name you entered display?
Hi,
Just to make sure, you are writing/placing the HTML in the Text tab and not the Visual tab, correct?
If you use the Visual tab and add html it will show up as text. For the HTML to work you need to click on “Text” and then add the HTML in that tab.
A few things, what exactly gets broken? You need to change the genesis hooks I gave you based on your theme. Example, if you footer is missing then the line that says remove footer you can remove it or just add “//” in front of that line.
Second question, do your acf fields show up? If so then great, all you need to do is then fix the genesis hooks.
If you use Page Link, you can then see all content. You can even filter out what to show or not. It’s not a simple as a button but a dropdown and allows for multiple selection.
Oh ok I misunderstood, your initial response “in all my posts which are pages”. So for pages:
// Remove Skip Links
remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
// Dequeue Skip Links Script
add_action( 'wp_enqueue_scripts', 'genesis_sample_dequeue_skip_links' );
function genesis_sample_dequeue_skip_links() {
wp_dequeue_script( 'skip-links' );
}
// Force full width content layout
// Remove site header elements
// remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
// remove_action( 'genesis_header', 'genesis_do_header' );
// remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
// Remove navigation
// remove_theme_support( 'genesis-menus' );
// Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
// Remove footer widgets
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
// Remove site footer elements
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
// Remove page title
// Remove site inner wrap
add_filter( 'genesis_structural_wrap-site-inner', '__return_empty_string' );
// Remove edit link
add_filter ( 'genesis_edit_post_link' , '__return_false' );
// Load landing page styles
add_action( 'wp_enqueue_scripts', 'landing_do_tables_styles' );
function landing_do_tables_styles() {
wp_enqueue_style( 'tables', CHILD_URL . '/tables.css', array(), PARENT_THEME_VERSION );
}
//======================================================================
// BEGIN ACF CONTENT
//======================================================================
Now you need to add the Genesis hook to display your content so add the following code.
‘add_action( ‘genesis_entry_content’, ‘anyname_here’ );
function anyname_here() {
Here add your your acf code. Example below
<?php }
//======================================================================
// END ACF CONTENT
//======================================================================’
It sounds like you are also not sure how to use the ACF code for a repeater field. I will give you and example code that you can then edit using the correct field name and html. I also recommend this page with more details https://www.advancedcustomfields.com/resources/repeater/
Here is an example code you could easily change to your settings, you would add this to the code above.
if( have_rows('your_repeater_field_name') ): ?>
<div class="any-class-name">
<?php // loop through rows (parent repeater)
while( have_rows('your_repeater_field_name') ): the_row(); ?>
<div style="background-color:<?php get_sub_field('your_color_field_name'); ?>">
<p><?php get_sub_field('your_description_field_name'); ?></p>
</div>
endwhile;
else :
// no rows found
endif;
</div>
?>
I haven’t tested the above code, but this has a repeater field, color picker and textarea. You need to change the code field names (anything with “your_field_name” change) to match what you created in acf. Look at the documents for each field if you run into an issue. With this you should be able to get it working. If still not working then send a screenshot of your acf fields and send the code you are using. Good Luck!
Hi Ally,
Ok so it sounds like you need to edit your posts single.php file. Also, note that Genesis requires it’s own hooks.
Any changes you made before like the plugins.php and to your functions.php etc…remove or save somewhere else, let’s start fresh.
Next, copy to your child theme the file “single.php” and add the following before “genesis();” these are the hooks that you can turn on or off depending on your theme design, otherwise you will get just the content and no header, footer etc…:
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout','__genesis_return_full_width_content' );
//* Removes the breadcrumb navigation
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Removes the post info function
remove_action( 'genesis_entry_header', 'genesis_post_info', 5 );
//* Removes the author box on single posts
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
//* Removes the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
Now we have to add the genesis loop, where I say “anyname” change to a name that makes sense, so now add the following:
//======================================================================
// BEGIN ACF CONTENT
//======================================================================
add_action( 'genesis_loop', 'anyname_loop' );
function anyname_loop() { ?>
<article itemtype="http://schema.org/company" itemscope="itemscope" class="post-<?php print $pageid; ?> page type-page status-publish entry">
<div class="entry-content" itemprop="text">
<div class="co-wrapper">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="co-title">
<h1><?php the_title(); ?></h1>
</div>
<strong>Add your ACF content in here along with any html you want.</strong>
</div>
</div>
</article>
This should get you started with where to drop your acf code and your html.
Lastly, if the site is live, I suggest testing this on a staging site or locally.
Hi,
Could you try this…
function horairesEte() {
ob_start();
if( have_rows('horaires_ete', 'option') ):
while ( have_rows('horaires_ete', 'option') ) : the_row();
return '<span class="jours">'.the_sub_field('jours').'</span><span class="ouverture">'.the_sub_field('ouverture').'</span>-<span class="fermeture">'.the_sub_field('fermeture').'</span>';
endwhile;
endif;
return ob_get_clean();
}
add_shortcode('horaires_ete', 'horairesEte');
I’m not sure what you are asking exactly but I did create a DAM for a client. I created a custom post type and then created my ACF fields and created a custom template for it.
I also created a smaller DAM version for another client. Which I used a standard post and depending on the category it would show the relevant DAM acf fields. Then used a shortcode to display the DAM category.
Hi Ally,
are you trying to show your acf fields in a template or as a shortcode?
R
Could you show the code you are using to display your acf field in your product template?
I believe you need to add the wordpress loop.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.