Jump to the DIVI POST SETTINGS Plugin Series

If you are interested in Divi Plugin creation jump to our post series!

Today we are going to talk about a little php snippet that can be useful for productivity when you have to post very often and always with the same basic post structure.

Divi, in fact, give you the possibility to set some basic layout options from the backend of every post thanks to a meta box called Divi Post Settings, basically the Sidebar Position (or alternatively a fullwidth post), the Dot Navigation, the Hide Nav before scroll and the Show/Hide Post Title.

The problem is that these settings are to be set every time you create a new post, definitely a trouble and a waste of time, your time.

So, the solution shown in this post will be very simple and will work without issues, but will not be the definitive answer. We will take this opportunity, in fact, for writing a Divi Plugin that can give you the ability to set your favorite default settings and we will show you the plugin under costruction, step by step in a “Divi Write Plugin” tutorial.

For now, however, give a quick php snippet answer is enough.

So, let’ get started!

THE PROBLEM
Ok, when we go into Post Divi Editor we see a meta box on the right called Divi Post Settings.

So what we want to do is just avoid losing time to having to set everytime the same Divi post parameters; we don’t want, on the other hand, lose the possibility to customize our default settings, so, definitely, what we have to do is simply change the deafult values leaving however the possibility to change them on single post backend.

This is why we can’t use simple css in order to get the result. In fact, we could hide the sidebar, show it on the left or the right, and also change other parameters with few lines of custom css, but this behaviour will be applied to all our posts ( this way in order to change the behaviour for a single post we should change everytime the css for the specific post itself using the post-id css class! ).

So, we will give a better and more flexible solution thanks to a php snippet we will add in our functions.php.

FUNCTIONS.PHP

First of all we have to find the source code we are interested in and this code live in functions.php file of Divi theme. Of course, we will not ovveride our original functions.php (it is never recommended!) but we will set up a Divi Child theme and then we’ll modify the functions.php of the child theme (see this post to see how to create a Divi Child Theme).

Once we have set up our Divi child theme we just have to copy and paste the code of function “et_single_settings_meta_box” we can find in ‘wp-content/themes/divi/functions.php.’ Subsequently we will just modify the order of some line of code and that’s it!

THE PHP CODE
So now simply add the following code to our (child theme) functions.php file.
Then make some order changes like the following ones.
Change to Fullwidth post
Hide Post Title by default
Set On the Hide Nav before scroll
Set On the Dot Navigation
FINAL THOUGHTS

All done. Now we can customize as we prefer the default values and everytime we create a new post we have these values already set. As i said, this is a practical and quick solution and could also be the definitive one; however in the next weeks we want to create a simple Divi Plugin will make easier the user life in order to get the same result and also with a new great functionality we will discover later on.

So, stay tuned to see the Divi Post Settings Plugin birth. See you next post.

Cheers!

SupportHost

You have Successfully Subscribed!

CodeCanyon Plugins

You have Successfully Subscribed!

Elegant Themes

You have Successfully Subscribed!

Try Divi!

You have Successfully Subscribed!

Divi Plugins

You have Successfully Subscribed!

Advanced Blurbs Plugin

You have Successfully Subscribed!

Bloom!

You have Successfully Subscribed!

Divi Cake Layouts

You have Successfully Subscribed!

Divi Cake Plugins

You have Successfully Subscribed!