Plugin showing before end of content

I’ve added a plugin to my site so that I can have a ‘related posts’ section at the bottom but this doesn’t work if I use a table of contents because the page numbers at the bottom are below the related post block. Is there a way of changing the code so that the top code appears before any other third party plugins?

I did try setting a custom css style to the plugin but that messed it up. You can see the problem here: https://www.horsefactbook.com/guides/understanding-horse-body-language/ - if you look at the source code you’ll see that the code for the Shareaholic plugin is above the page number code.

Hey Lucy,

Just update this code:

.shareaholic-canvas {
    float: left;
}

to

.shareaholic-canvas {
    float: left;
    width: 100%;
}

Hope this helps.

I did try that but then the page numbers where underneath the plugin, I’ve attached a screenshot

Hi Lucy,

Since you are using a third party plugin to add the related articles, it would be best to get in touch with the plugin developer regarding this due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

Thank you for your understanding.

I’ve spoken to the makers of the plugin and they said that there’s nothing they can do as the plugin is working properly. The problem isn’t the plugin itself its that the page numbers are put under the plugin rather than under the content. I had a look at the source files to see about moving the placement of it but couldn’t find the right file.

I’ve attached a screen shot of the source code to show what I mean.You can see that ‘page-links’ isn’t below the content but below the plugin

Hi Lucy,

Page numbers of table of content are put outside main content container to avoid html breakage.
You can see it on this template:
x\wp-content\themes\x\framework\views\global\_content-the-content.php
At line 17 -18 on that file you can see this part:

<?php the_content(); ?>
<?php x_link_pages(); ?>

The plugin that shows related posts, attached its content right after the content. That is why currently it is in between. We do have reason why we build it that way. An alternative solution is if the plugin offers a shortcode, you may copy that file above on the same folder path on a child theme, then edit the copied file, add the shortcode after this line <?php x_link_pages(); ?>

Hope this helps.

Thanks Lely

The shortcake option sounds a better way of doing that, how do I go about doing that? You said about creating a copy of it as well as creating a child theme - is that just incase anything goes wrong or does it have to be done via child themes? If so how do I create a child them?

Hello Lucy,

If you want to go with the shortcode route, then you will have to make use of a child theme. What you are trying to accomplish requires a template customization. The child theme allows you to make code changes that won’t be overwritten when an X update is released.

To install the child theme, you have to do this:

  • Download the child theme and upload it to your WordPress dashboard in Appearance > Themes like any normal theme. Please do not activate it yet.
  • Go to X > Validation > Theme Options Manager and download the XCS file to your local computer.
  • Go back to Appearance > Themes and then activate your newly uploaded child theme.
  • Go back again to X > Validation > Theme Options Manager and import the XCS file that you have previously downloaded. This is to make sure that your child theme will have the same settings as your parent theme.
  • Lastly, if you have made any file modifications, please make sure to note those files. Copy those files and place it in your child theme’s folder in the same order. And if you added any custom codes in your parent theme’s functions.php file, you will have to transfer those codes to your child theme’s functions.php file.

Once you have your child theme active and ready, please follow these steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/GLOBAL/_CONTENT-THE-CONTENT.PHP
// -----------------------------------------------------------------------------
// Display of the_content() for various entries.
// =============================================================================

?>

<?php do_action( 'x_before_the_content_begin' ); ?>

<div class="entry-content content">

<?php do_action( 'x_after_the_content_begin' ); ?>

  <?php the_content(); ?>
  <?php x_link_pages(); ?>

<?php do_action( 'x_before_the_content_end' ); ?>

</div>

<?php do_action( 'x_after_the_content_end' ); ?>

You may replace <?php x_link_pages(); ?> with <?php echo do_shortcode('[the shortcode here]'); ?>. Just make sure to insert the correct plugin shortcode.

3] Save the file named as _content-the-content.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/views/global/. You will have to create this folder path since it does not exist in your child theme yet.

Please let us know how it goes.

Thank you, it looks like I’ll need some courage to do that!

I’ll follow your steps.

Thanks

You’re welcome!
We’re glad we were able to help you out.

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