Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 512573

Selecting pages in customizer drop-down list

$
0
0

Replies: 0

Hello everyone,

WP newbie here. I am using the Benevolent theme. The static front page has a Community Section which displays featured images of up to 4 posts. However, I was hoping to display pages instead.

Customizer.php has code for a drop-down menu allowing the user to select posts. I made a child theme and tried to edit it so that options for pages are available instead:

Original

$options_posts = array();
$options_posts_obj = get_posts('posts_per_page=-1');
$options_posts[''] = __( 'Choose Post', 'benevolent' );
foreach ( $options_posts_obj as $posts) {
   $options_posts[$posts->ID] = $posts=>post_title;}

I tried replacing get_posts('posts_per_page=-1') with get_posts() (I didn’t put in any arguments because my understanding from the docs is that all pages are shown by default?) and ‘Choose Page’ with ‘Choose Post’ but that is as far as I have gotten. The drop-down list is coming up blank.

Any help would be very much appreciated! I vaguely understand what all the lines do but am a bit perplexed by line 3.

Thank you!


Viewing all articles
Browse latest Browse all 512573

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>