Archived topic
ACF with GeneratePress
5 replies · Started by Marcel on February 16, 2020
Hello,
I would like to add a ACF php code on Generatepress Elements.
This is the codeȘ
<?php if ( have_rows( 'pareri' ) ) : ?>
<?php while ( have_rows( 'pareri' ) ) : the_row(); ?>
<?php the_sub_field( 'oaspete' ); ?>
<?php the_sub_field( 'data_evaluarii' ); ?>
<?php the_sub_field( 'titlu' ); ?>
<?php the_sub_field( 'apreciere' ); ?>
<?php endwhile; ?>
<?php else : ?>
<?php // no rows found ?>
<?php endif; ?>
What should I choose from Elements Type? Header or Hook?
Thank you!
Hi there,
you would need to use a Hook Element as they allow PHP execution, whereas a Header Element does not.
Thank you, David!
Now, I would like to assign classes / ID’s to the advanced custom fields (https://www.screencast.com/t/L1ylNJMqCw).
Should I enqueue a new stylesheet to load them or could I use the Simple CSS plugin and insert there the new classes and ID’s I want to use?
If your CSS is going to be minimal i would just add it to your other CSS in Simple CSS.
If it is going to be a 400+ lines and only required on selective pages then i would look at enqueuing a style sheet
Thank you!
You're welcome