Home Forums ACF PRO v



  • Hello there!

    I am working on a website i have totally no problem using ACF. However i do have a question. When you create a custom post type in the functions.php of the theme directory you can create a simple WP_Query loop with the post_type the name of that custom post type and some arrays.

    The problem is.. i have created a OPTIONS page instead of a custom post field.. inside that page i have created ACF repeater with a image, title and description.

    Now i want to loop that content but it is not working with a default LOOP.. for the custom post type.

    this is my page custom options page:

    if( function_exists('acf_add_options_page') ) {
    	$page = acf_add_options_page(array(
    		'page_title' 	=> 'Course Settings',
    		'menu_title' 	=> 'Courses',
    		'menu_slug' 	=> 'course-settings',
    		'capability' 	=> 'edit_posts',
    		'icon_url'	 	=> 'dashicons-megaphone', 
    		'position' 		=> 5,
    		'redirect' 	=> false

    It works perfect.. but how can i LOOP a options page instead of a custom post type?

    So.. how would would you loop.. a custom page instead of a custom post type?

    Thanks in advance for the help!


  • Hi @nino88,

    You need “option” as the second parameter of the have_rows() function. Please take a look at this page:

    Hope this helps.

  • Hi!

    Great thanks. So i have one more question, a WP_Query loop will not work with an options page but only with a custom post type?

    So is there any huge difference between a loop and a repeater?

    So there is no good and bad for both of it?


  • Hi @nino88,

    Yes, WP_Query won’t work with options page because it isn’t a post. Please take a look at this page to learn more about WP_Query:

    WP_Query is a way for WordPress to get your posts or custom posts. A repeater is a custom field that you can add inside posts, custom posts, options page, etc. So you can use WP_Query to get the posts you want and then get the repeater inside that posts using have_rows() function. This page should give you more idea about it:

    I hope this makes sense.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘v’ is closed to new replies.