Tagged: x
-
AuthorPosts
-
February 23, 2017 at 3:27 pm #1383448
bdestrempesParticipantHey guys,
I’m using a custom read-more link with this on the Integrity stack:
// Excerpt More String // ============================================================================= if ( ! function_exists( 'x_excerpt_string' ) ) : function x_excerpt_string( $more ) { if (is_user_logged_in()) { return ' <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>'; } else { return '<div><a class="more-link" href="' . wp_login_url(get_permalink()) . '">Log in to read more</a></div>'; } } add_filter( 'excerpt_more', 'x_excerpt_string' ); endif; // Content More String // ============================================================================= if ( ! function_exists( 'x_content_string' ) ) : function x_content_string( $more ) { if (is_user_logged_in()) { return ' <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>'; } else { return '<div><a class="more-link" href="' . wp_login_url(get_permalink()) . '">Log in to read more</a></div>'; } } add_filter( 'the_content_more_link', 'x_content_string' ); endif;This works fine on the general blog listing but the link doesn’t show up on category listings. I was under the impression categories would use the same function, am I missing something here?
You can take a look on http://www.visionmountain.com/blog and http://visionmountain.com/category/consciousness-and-life-issues/
Thanks.
February 23, 2017 at 11:44 pm #1383914
Rue NelModeratorHello There,
Thanks for writing in! Do you have any other custom functions that may have some conflict in this? Would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
February 24, 2017 at 10:01 am #1384358
bdestrempesParticipantThis reply has been marked as private.February 24, 2017 at 1:16 pm #1384580
JadeModeratorHI there,
I tried to login using the details you provided but it doesn’t seem to work.
Kindly double check it so that we could assist you further.
Thank you.
February 24, 2017 at 1:22 pm #1384588
bdestrempesParticipantThis reply has been marked as private.February 24, 2017 at 9:59 pm #1385062
Rue NelModeratorHello There,
Thanks for updating in! I have logged in and after that I am just seeing this:
http://prntscr.com/ed36toPlease allow us to view the admin page.
Thank you.
February 24, 2017 at 10:04 pm #1385069
bdestrempesParticipantUser had no role set for some reason, should be fixed.
February 25, 2017 at 3:00 am #1385235
ChristopherModeratorHi there,
Login to read more link shows fine on archive page (see the attachment) but in blog page it doesn’t due to following blocks of code :
.blog #read-more { display: none; } .blog .has-post-thumbnail .entry-content { display: none; }Please remove those blocks.
Hope it helps.
February 25, 2017 at 8:21 am #1385386
bdestrempesParticipantHi,
The .blog class targets the http://visionmountain.com/blog page and not the individual category pages. .entry-content shows up on those pages (with body classes of .archive and .category, not .blog).
#read-more is a div added to content.php to show users who are not logged in:
<?php echo '<div style="text-align: center;" id="read-more"><a href="' . wp_nonce_url(wp_login_url(get_permalink()), 'login_') . '">Log in to read more</a></div>'; ?>However, logged in users should still see the regular Read More link at the end of the excerpt (added with the read more tag in the individual posts).
February 25, 2017 at 10:33 am #1385451
bdestrempesParticipantI fixed the problem by adding the following to my child theme’s content.php:
<?php if (is_user_logged_in()) { echo ' <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>'; } else { echo '<div><a class="more-link" href="' . wp_nonce_url(wp_login_url(get_permalink()), 'login_') . '">Log in to read more</a></div>'; } ?>It feels more like a hack than anything else though, so I’m all ears if anyone has a better solution.
Thanks.
February 25, 2017 at 5:27 pm #1385700
RadModeratorGlad to hear that and thanks for sharing!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1383448 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
