Quantcast
Viewing latest article 45
Browse Latest Browse All 160

Options and Repeater in Sidebar, oh my

I am trying to do an Option with a repeater in it AND put it in my sidebar, which has gotten me in over my head. I have e=never done a repeater in an Option before, so I will strt with what I wrote there -

The repeater is called "book", and the subfields are "book_cover" (an image witha custom image size I set up called "book"), "book_title" (text) and "book_link" (text)

This is the code I wrote for it, which I think is broken:

` <?php if(get_field('book', 'options')): ?> <?php while(the_repeater_field('book', 'options' )): ?> <?php $attachment_id = get_sub_field('book_cover'); $size = "book"; $image = wp_get_attachment_image_src( $attachment_id, $size ); ?>

`

And then the second part is that I want to add this to my sidebar.php file and I am not sure how to do it without breaking everything.

All the sidebar file has in it is: `

` I am not sure if my code should go before the endif, or if I need to add other things in there - I am confused. ;-)


Viewing latest article 45
Browse Latest Browse All 160

Trending Articles