• 0
Sign in to follow this  
Followers 0

Add divider shortcode

Question

Posted · Report post

Hi there,

 

I want to add a [divider] shortcode to my website's functionality in the post loop section (in the normal WP-page design) and have tried to do the following, and it didn't work. 

 

Can you please advise how I can add this shortcode to my functionality and styling.

 

Cheers!

 

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

Posted · Report post

Are we talking about an h-rule line?  As described in here? http://www.w3schools.com/tags/tag_hr.asp

 

Is the line that you're trying to create horizontal or vertical?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Yes, thankyou Rob - perfect!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi,

 

Yeah the HR tag should work just fine, but I have just created a custom shortcode and that [divider] working just fine.

 

I added the following the code to my child themes functions.php file:

add_shortcode( 'divider', 'custom_shortcode' );
 
  function custom_shortcode() {
 
    return '<div class="divider"></div>';
}

Then added the following CSS to Custom CSS:

 

.divider {
  background: #444;
  height: 1px;
  width: 90%;
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0