Tagged: x
-
AuthorPosts
-
November 13, 2016 at 11:52 pm #1255895
davidferpParticipantHello X-team,
I am working to add these three elements (in this order) after the content of every blog post:
1) Previous/Next buttons for blog post navigation
2) Social sharing buttons
3) A recent posts stripAfter making changes in my /x-child/functions.php (in the active child theme) I see I cannot horizontally align the thumbnails in the recent posts strip (see attached picture). Any way to force the alignment?
Also, I would like to know if the functions.php is the right place fur these changes or I should place them somewhere else like in the /x-child/framework/views/global/_content-the-content.php?
For your reference, my /x-child/functions.php looks like this:
<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Overwrite or add your own custom functions to X in this file. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Enqueue Parent Stylesheet // 02. Additional Functions // ============================================================================= // Enqueue Parent Stylesheet // ============================================================================= add_filter( 'x_enqueue_parent_stylesheet', '__return_true' ); // Add Recent posts after the single post content // ============================================================================= function x_add_recent_posts ( $content ) { if ( is_singular('post') ) { echo do_shortcode('[recent_posts count="3"]'); } } add_action('x_before_the_content_end', 'x_add_recent_posts'); // Add Social Sharing after the single post content // ============================================================================= function x_add_social_sharing ( $content ) { if ( is_singular('post') ) { echo do_shortcode('[share title="Share This Story" facebook="true" twitter="true" google_plus="true" linkedin="false" pinterest="true" reddit="false" email="true"]'); } } add_action('x_before_the_content_end', 'x_add_social_sharing'); // Add Previous/Next buttons in single post content // ============================================================================= function add_next_post_item_link ( $content ) { if ( is_singular('post') ) { $prev_name = do_shortcode('[x_icon type="chevron-circle-left"]') . ' Previous Story'; $next_name = 'Next Story ' . do_shortcode('[x_icon type="chevron-circle-right"]'); $next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : ''; $prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : ''; $posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>'; return $content . $posts; } else { return $content; } } add_action ('the_content', 'add_next_post_item_link' );Thanks a lot!
November 13, 2016 at 11:54 pm #1255897
davidferpParticipantThis reply has been marked as private.November 14, 2016 at 1:16 am #1255961
ChristopherModeratorHi there,
Please add following code in Customize -> Custom -> Global CSS :
.wp-post-navigation-next { display: inline-block; width: 100%; }You added your code in the right file.
Hope that helps.
November 14, 2016 at 4:02 am #1256123
davidferpParticipantThanks a lot Christopher, that code worked like a charm, as always.
Perfect as always 🙂November 14, 2016 at 4:38 am #1256164
ChristopherModeratorYou’re welcome.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1255895 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
