Support

Account

Home Forums ACF PRO Add HTML to style my PHP

Unread

Add HTML to style my PHP

  • Here’s my PHP:

    <?php if ( have_rows( 'category_listing' ) ) : ?>
    	<?php while ( have_rows( 'category_listing' ) ) : the_row(); ?>
    		<?php the_sub_field( 'category_title' ); ?>
    		<?php $icon = get_sub_field( 'icon' ); ?>
    		<?php if ( $icon ) { ?>
    			<img src="<?php echo $icon['url']; ?>" alt="<?php echo $icon['alt']; ?>" />
    		<?php } ?>
    		<?php if ( have_rows( 'item_list' ) ) : ?>
    			<?php while ( have_rows( 'item_list' ) ) : the_row(); ?>
    				<?php the_sub_field( 'item' ); ?>
    			<?php endwhile; ?>
    		<?php else : ?>
    			<?php // no rows found ?>
    		<?php endif; ?>
    	<?php endwhile; ?>
    <?php else : ?>
    	<?php // no rows found ?>
    <?php endif; ?>

    Here is what I’m trying to style it to look like:

    https://imgur.com/a/kq95G67

    I can’t get my DIVs correctly around the PHP tags though, so when I style using Flexbox it comes out a mess and elements that aren’t supposed to be nested are. I’m not asking anyone to add specific styling, just maybe some DIV tags around each PHP type, for instance “category_listing” “item_list” and “item”.

    Thanks.

Viewing 1 post (of 1 total)

The topic ‘Add HTML to style my PHP’ is closed to new replies.