- This topic has 7 replies, 2 voices, and was last updated 3 years, 1 month ago by David.
-
AuthorPosts
-
February 19, 2021 at 9:15 am #1664782Ketil
Hello. I would like to make a simple interface for logged user to change the bg-image in a header element. The image-reference would be in form of a shortcode, so my question is if there is a way to have the header element read the shortcode instead of changing this is the element. The object would be to not allow the user to change anything in the element itself, but provide a simple interface to change the bg-image.
Ketil
February 19, 2021 at 9:25 am #1664795DavidStaffCustomer SupportHi there,
why not use the Featured Image for the post/page for the Header Elements Background Image?
February 19, 2021 at 10:48 am #1664880KetilI’m making a “one page”-setup for “dummies”, where I use forms and shortcodes for content. Trying to avoid having to explaing how to change elements or edit the page (if I allow them to edit the page, then there is the possibility of them messing up the setup of the one-page design). Preferably I would have used “Landing” from library, but there the top image is part of the content. I don’t want to explain blocks, featured image etc, just lead them trough a form setup, with no frills, pick the image, fill out the text, and then use shortcodes in the block to make up the “one page”-website, using anchors to navigate like “landing” does. Pretty straightforward to set up, except for the image.
February 20, 2021 at 3:53 am #1665374DavidStaffCustomer SupportWhats the Form setup ? Are you using ACF or something similar to generate the content / shortcodess ?
February 20, 2021 at 4:00 am #1665380KetilI’m using formidable forms Pro, creating av view for the result that has the form of a shortcode.
February 20, 2021 at 5:44 am #1665463DavidStaffCustomer SupportAah ok – well unfortunately what you’re trying to do is not possible. Shortcodes return their content within the post content, you can’t simply extract one of their attributes/properties that could be used to filter the Header Element background image.
February 20, 2021 at 7:49 am #1665737KetilWhat if I got the image path from a form-submission, would there be a way to use it for a header-element?
It’s supposed to be a very “low threshold” way for new businesses to manage a “one page”-setup, without editing pages or elements.February 20, 2021 at 8:56 am #1665786DavidStaffCustomer SupportIt depends where the URL gets posted. Here for example is a Filter for changing the Hero background image using a custom field:
add_filter( 'generate_page_hero_background_image_url', function( $url ) { $background_image = get_field( 'category_featured_image' ); if ( $background_image ) { $url = $background_image; } return $url; } );
If you can get whatever variable the form submits you can parse it through that filter.
Or looking at Formidable Forms website its says under: User Submitted Posts & Pages – you can add a Featured Image….
-
AuthorPosts
- You must be logged in to reply to this topic.