How to put a revolution slider at the bottom of all posts in a category?

Hey. I’d like to put a particular revolution slider at the bottom of all posts in a category, adding the shortcode to the functions.php.

I already have an author box occurring at the bottom of those posts, and the revolution slider would ideally sit above that, yet below the post content.

Here is a view of the code i’ve got in functions.php in my Pro Child theme now --> https://cl.ly/25f2468e5a15

How can I make this happen?

Hi Peter,

Thanks for reaching out.

You can add the slider shortcode along with the social share shortcode. Example,

echo do_shortcode('[rev_slider alias="TEST"][share title="Share th................................

I just taken the part of your existing code as a sample, and you may enhance it as recommended :slight_smile:

You should able to find your slider shortcode through its setting.

Thanks!

Um … that gave my site a whitescreen.

Then I was lost at what I changed in the code. I had to delete the code which put in the social sharing buttons.

I can’t copy & Paste off of the screenshot I sent you of the previous code. Sorry. Would you please show me how to create the social sharing code at the bottom again that I had to delete?

(And would you please include a second version of that code which includes the revolution slider add-on, so I can test?)

ALSO

This is what I want -

I want a particular slider to appear at the bottom of ‘From the Quest of Peter Fae’ category. And I want a DIFFERENT particular slider to appear on the bottom of ‘From the Quest - Yeshua Lucis’ category.

I apologize for the confusion. It’s very intense over here we’re just launching.

Would you be so kind as to -->

  1. Provide the code to put the social share at the bottom of posts (remember the screenshot I gave you won’t allow copy & paste)
  2. Create a second set of code which shows how to add the [rev_slider alias=“ftq-yeshualucis”] underneath the category - “From the Quest - Yeshua Lucis” only in that category and how to add the [rev_slider alias=“FTQ-peterfae”] underneath the category - “From the Quest of Peter Fae”?

If that’s too much of a hassle, I would just like the restored social share code :slight_smile:, yet would very much appreciate it.

… i’m just wanting to have a slider which shows the posts from each of those categories beneath those categories, along with the social share.

THank you. Truly. Lots of stress out here. Thanks.

Hi Peter,

May I know how you added it? You have to edit the existing code you have shown in your screenshot and just add the slider in front of the sharing code. Example, replace this part

echo do_shortcode('[share

with this part

echo do_shortcode('[rev_slider alias="TEST"][share

And not by replacing the entire code. But if you just accidentally added it in the wrong place then you can fix it by removing it from the place where you added it. And please don’t provide your codes and credentials in a screenshot in the future, a text copy is more recommended that will also serve as your back-up :slight_smile:

Here is the code for the sharing code that I copied from your screenshot.


add_action( 'x_before_the_content_end', 'x_print_social', 999);

function x_print_social() {

if ( is_singular('post') ) {


echo do_shortcode('[share title="Share the Magick!" facebook="true" google_plus="true" linkedin="true" pinterest="true" reddit="true"]');
echo '<p style="text-align: center;"><a href="https://intothemythica.com/subscribe//">LIKE THIS ARTICLE? WANT TO HELP CHANGE THE WORLD? CLICK TO JOIN THE MYTHICA!</a>';


}

}

And add this code for the category related slider, please ignore the previous instructions :slight_smile:

add_action( 'x_before_the_content_end', 'x_post_category_slider', 998);

function x_post_category_slider () {

if ( is_singular('post') ) {

 $category = get_the_category( get_the_ID() )

 $slider = "";

 if ( count( $category ) > 0 ) {

 	switch ( $category[0]->term_id  ) {
 		case 223: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;
 		case 228: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;
 	}

 echo do_shortcode( $slider );
 }


}

}

Again, you’ll have to enhance that code to achieve your main goal. Example, let’s say the category From the Quest - Yeshua Lucis has an ID of 223, then this is the line responsible for that

case 223: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;

Or category From the Quest of Peter Fae has an ID of 228, then the line is

case 228: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;

The ID is just an assumption, you’ll have to check your category IDs manually, please check this https://theme.co/apex/forum/t/setup-how-to-locate-category-ids/60

Again those two lines are just sample, you have to enhance it by changing the category ID, slider shortcode, and even adding more lines. And this should serve as snippet and an idea and we don’t cover code maintenance, I recommend contacting a developer of maintaining this code.

Thanks!

Yah adding the second bit, the one that added the rev slider in the categories, created the white screen.

Not sure. I put this in -->

// Add revolution slider at bottom of category for Peter and Yeshua From the Quest

add_action( ‘x_before_the_content_end’, ‘x_post_category_slider’, 998);

function x_post_category_slider () {

if ( is_singular(‘post’) ) {

$category = get_the_category( get_the_ID() )

$slider = “”;

if ( count( $category ) > 0 ) {

switch ( $category[0]->term_id  ) {
	case 634: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;
	case 663: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;
}

echo do_shortcode( $slider );
}

}

}

I realize that you’re not responsible for code. So I am deeply thankful for any bits that help. For what it’s worth, these little bits of information are truly helping us out as we’re really moving into publishing. I checked the ID #'s and the shortcode names on the sliders, so unsure why it created the white screen. Do you have any other info on why this would happen?

Hello Peter,

There is a missing ; in the previous code that is causing a fatal error that only shows a white screen.

Please try this code:

// Add revolution slider at bottom of category for Peter and Yeshua From the Quest

add_action( 'x_before_the_content_end', 'x_post_category_slider', 998);

function x_post_category_slider () {

    if ( is_singular('post') ) {

        $category = get_the_category( get_the_ID() );

        $slider = "";

        if ( count( $category ) > 0 ) {

            switch ( $category[0]->term_id  ) {
                case 634: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;
                case 663: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;
            }

            echo do_shortcode( $slider );
        }


    }

}

Hope this helps.

Mmm … its not breaking the site yet it’s not doing what we’re looking for either.

See, in this post it should show the slider at the bottom --> https://intothemythica.com/2019-4-1/

and it’s not.

Not sure why. I’m putting a secure note in if you want to look at the SFTP on it. BTW - I know this kind of stuff pushes on the envelope of X-support. I really really really appreciate it. We’re doing a super-spiritual project designed to help the planet, and I do so much on my won with my ever-expanding knowledge of the digitals. All help is so deeply appreciated. * bows *

Hi Peter,

You only copied this code to your functions.php file:

function x_post_category_slider () {

    if ( is_singular('post') ) {

        $category = get_the_category( get_the_ID() );

        $slider = "";

        if ( count( $category ) > 0 ) {

            switch ( $category[0]->term_id  ) {
                case 634: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;
                case 663: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;
            }

            echo do_shortcode( $slider );
        }


    }

}

But you missed this code:

add_action( 'x_before_the_content_end', 'x_post_category_slider', 998);

I’ve already corrected it and the slider’s appearing at the bottom of posts now.

Cheers!

You all are SO KIND. So very very kind. Thank you.

One last bit … how to get the slider above where the Author Box is?

thank you thank you thank you

Hey Peter,

Please edit the functions.php file them remove this block of code:

// Add Author at bottom of all posts

function add_author() { 
if(is_singular('post')){
   $author_id =  get_the_author_meta('ID');  
   echo do_shortcode('[author title="About the Author" author_id="'.$author_id.'"]');
}
}
add_action( 'x_before_the_content_end', 'add_author', 10 );

Then update the previous code to:

// Add revolution slider beneath categories for from the quest
// Add Author at bottom of all posts
add_action( 'x_before_the_content_end', 'x_post_category_slider', 998);
function x_post_category_slider () {

    if ( is_singular('post') ) {

        $category = get_the_category( get_the_ID() );

        $slider = "";

        if ( count( $category ) > 0 ) {

            switch ( $category[0]->term_id  ) {
                case 634: $slider = '[rev_slider alias="ftq-yeshualucis"]'; break;
                case 663: $slider = '[rev_slider alias="FTQ-peterfae"]'; break;
            }

            echo do_shortcode( $slider );
        }

        $author_id =  get_the_author_meta('ID');  
        echo do_shortcode('[author title="About the Author" author_id="'.$author_id.'"]');


    }

}

Hope this helps.

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