Archived topic
Add read more for long sections on page.
19 replies · Started by Alice on October 7, 2015
Hi. I've had a quick search and found almost but not quite the answer to my question.
I'd like one page, with 3 sections, each section shows an excerpt which can be expanded / read more. The traditional read more html <!--more--> doesn't do much, and the sections add on would remove an essential side bar.
I'd like the read more function so the visitor can see the 3 sub headings on first visit, then find the relevant section.
Would this function.php work for a page?
add_filter( 'the_content_more_link', 'modify_read_more_link' );
function modify_read_more_link() {
return '<a class="more-link" href="' . get_permalink() . '">Your Read More Link Text</a>';
}
I wonder if a plugin like this may do what you're looking for?: https://wordpress.org/plugins/jquery-collapse-o-matic/
Hi Tom. Thank you for the link, yes... something like that!
However, I've some quirk in my system, I've disabled all but two plugins to check, everything works except.... any plugin that relates to collase/hide. [Although WP shortcode is working} - it has consumed much of my day.
ok, I'm hair pulling... I switched themes to check, and these plugins work in other themes. So I stripped my child theme down to basics. Should I update my generate press?
Keeping up to date with GP is always a good idea, but not being up to date shouldn't break this.
Can you link me to your site where you're using the plugin? There might be a JS error somewhere I can spot :)
Sorry for multiple posts... tried using GP not my child GP and all the plugins work. So, somehow it's my childtheme, missing a java script or something. [All new to me this].
I'd really appreciate the support (can be a lonely world!)
http://www.ursulaholdengill.com
most of site is private (does this make a difference to your enquiry?)
I'll make a page public, it has a mess of attempts to collapse/expand on http://www.ursulaholdengill.com/education
wait a moment whilst I revert back to my child theme - again thank you sooooo much.
Hmm, looks like there might be a PHP error somewhere stopping the site from printing out the footer area.
Can you try #2 on this article and let me know if any errors appear?: https://generatepress.com/knowledgebase/debugging/
Do I paste refine, false true etc into my child functions.php? Or set up a child wp_config.php ?
Use your already existing wp-config.php.
Does your footer area show up when your child theme isn't activated?
Everything is good when child theme not activated, all steady, the dashboard menu is visible across site, footer visible and the plugins work.
p.s. no wp-config.php visible in GeneratePress theme editor.
btw here is my style intro...
/*
Theme Name: GeneratePress Child
Theme URI: http://ursulaholdengill.com/generatepress-child/
Description: Child theme based on Generate Press
Author: Alice Mill
Author URI: http://mrsmill.info
Template: generatepress
Version: 1.3.14
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, fluid-layout, fixed-layout, responsive-layout, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, featured-images, theme-options, light, white, dark, black, blue, brown, gray, green, orange, pink, purple, red, silver, tan, yellowLicense: GNU General Public License v2 or later
Text Domain: generatepress-child
*/
my header is a copy of GP header
my functions.php...
<?php /*
This file is part of a child theme called GeneratePress-child.
Functions in this file will be loaded before the parent theme's functions.
For more information, please read https://codex.wordpress.org/Child_Themes.
Add your own functions below this line.
========================================== */
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
ok... I deleted a footer.php in my child. I thought I'd need it to personalise the copyright at the bottom. And... everything is sweet, beautiful, smelling of roses.
Hi Alice. The wp-config.php file is in your root WP directory. You should be able to access it via cPanel or FTP. In your child theme functions.php file you don't need to enqueue the parent style sheet. The theme automatically detects the child theme and enqueues both the parent and child style sheets.
