Archived

This topic is now archived and is closed to further replies.

  • 0

Resolved Add background image setting to my custom section


Question

Posted · Report post

Hi there,

I just create custom section and I need it to have background option selector (select image, background repeat, background potition).

I copy the code from pageline code


'page_background_image' => array(

'title' => __( 'Site Background Image (Optional)', 'pagelines' ),	

'shortexp' => __( 'Setup a background image for the background of your site', 'pagelines' ),

'exp' => __( 'Use this option to apply a background image to your site. This option will be applied to different areas depending on the design mode you have set.<br/><br/><strong>Positioning</strong> Use percentages to position the images, 0% corresponds to the <strong>top</strong> or <strong>left</strong> side, 50% to center, etc..', 'pagelines' ),

'type' => 'background_image',

'selectors' => cssgroup('page_background_image')

),

and chage parameter name. The selector show up, but it CANNOT save, It's back to default state after save.

Do you have any suggestion? or some example of section that have background option selector.

Thanks

Share this post


Link to post
Share on other sites

6 answers to this question

Posted · Report post

It's hard to say without seeing the rest of the code around what you copied. I'm guessing it's mostly because you used the same option id as the page_background_image which is going to conflict with.. that option :). Option id's need to be unique. Something like sectionslug_background_image would be better. It's a background for the section, not the page right? If so, the selectors key won't be necessary.

For an example of how this option is made use of, you can check out the do_background_image function inside includes/class.render.css.php.

Hope that helps!

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Evan

I had change option_id, It's not work either.

Now I combine 'image_upload' and 'select' to work like 'background_image' instead :)

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

Is this now resolved ?

Share this post


Link to post
Share on other sites

Posted · Report post

Yes, can't find where I can mark this as resolved.

Thanks.

Share this post


Link to post
Share on other sites

Posted · Report post

Marking it as resolved for you.

Share this post


Link to post
Share on other sites

Posted · Report post

The topic was marked as resolved.

Share this post


Link to post
Share on other sites