0

I have a custom post type which is named products. Each product will have overview/details/pricing.

How can i make a navigation inside my post-type for each field? Example:

  • Product 1: (Custom Post Type Product)

    • Overview/Details/Pricing (Custom Fields i guess)

On overview click i want to display an overview for the product, (maybe use a child page and load into the overview field? )

I'm really confused, can anyone help?

2
  • You could create a repeater field with 2 fields; 1) title 2) link (to create a menu). Then you loop through that which outputs the links you have entered. You can create 'fake subpages' which retrieve the info from the product post or create actual subpages and enter the info there.
    – Beee
    Commented Mar 26, 2018 at 13:09
  • @Beee can you explain that a little bit more with an example please? I'm really struggling to get into this thing. Commented Mar 26, 2018 at 13:11

1 Answer 1

0

Ok, as requested.

Create an ACF field. Add a repeater field. Inside the repeater, add a text field with name title. Inside the repeater, add an URL field with name link.

$menu_items = get_field( 'repeater_field' )

if ( $menu_items ) {
    echo '<ul>';
    foreach( $menu_items as $item ) {
        echo '<li><a href="{{ item.link }}">{{ item.title }}</a></li>';
    }
    echo '</ul>';
}

You can then link to any sub-pages you have created.

5
  • repeater fields are now available only on pro version.. Commented Mar 28, 2018 at 9:42
  • Buy the pro version. It's only 25 bucks but it's worth its weight in gold. It's by far the best WP plugin I ever bought ! And they're about to release a new version with a lot more options. It will make your website so much easier to manage.
    – Beee
    Commented Mar 28, 2018 at 11:10
  • I can use normal fields, to do my job in this case, every page of my custom post type has the same fields, so why not? Commented Mar 28, 2018 at 11:12
  • Then I can't help you sorry. I have never used the free version.
    – Beee
    Commented Mar 28, 2018 at 16:09
  • i found an easier solution using load() function of jquery and normal fields! thanks anyway. Commented Mar 28, 2018 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.