Before Content Widget Area

Hi, I want to add a “before content widget area” - I don’t want to use Cornerstone for it, I just want to have a way to add a bit of text, icons, whatever, in a widget before the content of every blog post. How do I do this?

Hi Sebastian,

This is a customization request and it is outside of our support scope. We will do our best to show you how to implement the customization, but we will not be able to implement the feature for you.

Please follow the steps below:

  • Create a new Sidebar. For more information click here.
  • Go to Appearance > Widgets and assign the widget you want to the sidebar that you have created.
  • Go to X/Pro > Global Blocks, create a new Global Block and use the Widget Area element to add the Widget Area in question to the block. Click here for more information.
  • The global block will generate a shortcode. Write down that shortcode.
  • Install the X or Pro Child Theme.
  • Go to the functions.php file of the Child Theme and add the code below there:
function custom_widget_area() {

  if ( is_single() ) {
    echo do_shortcode('PASTE THE SHORTCODE HERE');
  }

}

add_filter( 'x_before_the_content_begin', 'custom_widget_area' );

Replace PASTE THE SHORTCODE HERE with the Global Block shortcode that you wrote down in previous steps.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.