Replies: 0
Assign featured images to pages that are included in “Sections”
hello dear Experts good day dear WordPress-fans for the great twentyseventeen-theme.
for a new Website I am making at the moment i am working out the design principles.
i’m currently working on the Twenty-seventeen theme. I’m trying to make each “page” display as a section on my homepage. i guess that however I’m clearly missing a step.
I’ve already gone into my settings (both from the dashboard and within the customizer)
There is a section called featured products with images showing: Features Images.
Currently I have to update these images manually through my front-page.php file
I need a custom section in the customiser called something like featureImages
There would have to be 4 upload sections like:
featureImage-a featureImage-b featureImage-c featureImage-d
Generally speaking: The page selection is set within the Customizer under the so called Theme Options, which will only show when front page is set to static.
So far so good: The output happens within the function twentyseventeen_front_page_section in the theme file template-tags.php, where each panel is queried individually with get_post, so it’s not exactly a loop in the conventional sense.
We are able to change the number of sections from the default 4 with the twentyseventeen_front_page_sections filter, which should return the number of desired sections. to access the values via code, we can use get_theme_mod, each panel is stored under the key panel_$i, where $i is the section number, starting at 1.
The stored value is the ID of the page that were working on.
That said – we subsequently can also update these values with set_theme_mod.
I’ve seen this on some themes but I just don’t know how they do it.
I’ve tried searching for this but I don’t really know how to put it into words for Google to give me a result. I apprentice any help or if you could point me in the right direction if this has been asked before 🙂
How to assign the so called featured images to pages that are included in “Sections”?
i have heard that the wordpress-customizer of the theme twentyseventeen has got a special control for file uploads.
Well assuming that this is correct then i guess that i need to know how the theme customizer works exactly,
I guess that i need to organize it like so:
$wp_customize->add_control(
new WP_Customize_Upload_Control(
$wp_customize,
'wpse-all-the_images',
array(
'label' => __( 'First image', 'wpse-allimages_theme' ),
'description' => __( 'More about first image', 'wpse-allimages_theme' ),
'section' => 'wpse-allimages__section_id',
'settings' => 'wpse-allimages__setting_id',
) )
);
with that we would be able to retrieve the image in the template with get_theme_mod(‘wpse-allimages’).
Any help would be appreciated. Thanks.
i love to hear from you.
regards