[Resolved] ACF with GeneratePress

Home Forums Support [Resolved] ACF with GeneratePress

Home Forums Support ACF with GeneratePress

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1166882
    Marcel

    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!

    #1166883
    David
    Staff
    Customer Support

    Hi there,

    you would need to use a Hook Element as they allow PHP execution, whereas a Header Element does not.

    #1166910
    Marcel

    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?

    #1166941
    David
    Staff
    Customer Support

    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

    #1172291
    Marcel

    Thank you!

    #1172434
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.