• Hi there,

    The portfolios that are currently displayed on my homepage have text underneath them that consists of the first sentence or two of the portfolios content. Is there a way I can shorten this text so it takes up less space or better yet can I write my own text? Is there also a way I can narrow the spacing slightly to take up less room?

    My pages also have the ‘home’ and ‘blog’ titles with a thin black line underneath it. Is there any way I can hide both the title and line? I appreciate any help anyone can provide, thanks!

    World of tea infusers

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Is there a way I can shorten this text so it takes up less space or better yet can I write my own text?

    Portfolio projects don’t support custom excerpts out of the box, but you can add a function to your child theme to add the ability to add manual excerpts:

    function jetpackme_portfolio_excerpts() {
    	add_post_type_support( 'jetpack-portfolio', 'excerpt' );
    }
    add_action( 'init', 'jetpackme_portfolio_excerpts' );


    Courtesy of Jeremy over at Jetpack.

    You’ll need to create a child theme and place this function in your child theme’s functions file. If your functions file is empty, you’ll need to add an opening <?php tag at the very top.

    Once your child theme is active, you should see a box for adding an Excerpt to each portfolio project. If you don’t see it, open the Screen Options panel at the top of the page and check it off to display it.

    Is there also a way I can narrow the spacing slightly to take up less room?

    Which spacing are you referring to? If you’d like to tighten the line spacing on the excerpts, you could try something like this in your custom CSS or child theme:

    .jetpack-portfolio-shortcode .portfolio-entry-content {
     line-height: 1.3;
    }
    Thread Starter royaltea1

    (@royaltea1)

    I’m trying to create a child theme and I’m having trouble with the functions.php file. I used the code from the codex link attached but I’m not sure if I’m missing something:

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }

    On my themes page on my dashboard I also see a ‘broken theme, template is missing error’. Am I inserting the correct code for the functions.php file?

    Moderator Kathryn Presner

    (@zoonini)

    royaltea1 – the Codex code is just there as an example, you need to replace pieces of it with your own theme’s namespace so your child theme knows which parent to look for.

    I’d usually recommend something like this:

    function illustratr_child_enqueue_child() {
      wp_register_style( 'illustratr', get_template_directory_uri() . '/style.css' );
      wp_enqueue_style( 'illustratr-child', get_stylesheet_uri(), array( 'sorbet' ) );
    }
    add_action( 'wp_enqueue_scripts', 'illustratr_child_enqueue_child' );

    Could you please start a new thread if you need further help, as this thread is unrelated to your issue? Thanks.

    Moderator Kathryn Presner

    (@zoonini)

    Oh never mind, you can keep posting here in this thread – I just realized you’re the original poster. Sorry. 😉

    Thread Starter royaltea1

    (@royaltea1)

    Hi Kathryn,

    I tried using the code you provided but I’m still receiving a ‘template missing’ error on my dashboard. I’m not sure what else I need to add or what pieces I’m suppose to replace? Could it possibly have something to do with the beginning of my style.css sheet?

    I tried doing a search as well but can’t find anything helpful with where I am currently stuck.

    I appreciate all your help so far! 🙂

    Thread Starter royaltea1

    (@royaltea1)

    After my last post I realized I should post my style.css sheet and noticed it was empty when I went to copy the code. I must have not saved it from the last time I was working on it.

    So I went back and entered the following in my style.css sheet

    /*
    Theme Name: Illustratr Child
    Theme URI: http://example.com/illustratr-child/
    Description: Illustratr Child Theme
    Author: John Doe
    Author URI: http://example.com
    Template: illustratr
    Version: 1.0.0
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    Text Domain: illustratr-child
    */

    I was then able to activate the Illustratr child theme which I was super happy about but when I view my page now it just appears as plain text and no css. I’m not sure what I’m missing? I used the sample codex and changed the wording to say the illustratr theme.

    I have kept the functions.php file as is from what I copied from your earlier post and haven’t made any changes.

    Moderator Kathryn Presner

    (@zoonini)

    My apologies! I made an error when copying your function from another thread and left the old theme name in. Please change this line:

    wp_enqueue_style( 'illustratr-child', get_stylesheet_uri(), array( 'sorbet' ) );

    to this:

    wp_enqueue_style( 'illustratr-child', get_stylesheet_uri(), array( 'illustratr' ) );

    Sorry about that! Let me know if that does it.

    Thread Starter royaltea1

    (@royaltea1)

    Hi Kathryn,

    Thank you so much for all of your help! I copied the code and my theme is now displaying properly 🙂 I was also able to add the manual excerpt function and tighten the line spacing as well.

    In the manual excerpt box I added a line of html to add a “read more” link at the end of my content. Do you know if this is the best way to display a read more link? Can I use html (it helps keeps things simple) or does a function need to be added to my functions file?

    One final question – if I add any css changes going forward, is it better to enter the css code into the ‘edit css’ on my dashboard or is it better to add the code to my style.css sheet? (or does it not matter?)

    Thanks again for all of your help! I really appreciate it!!

    Moderator Kathryn Presner

    (@zoonini)

    Thank you so much for all of your help! I copied the code and my theme is now displaying properly 🙂 I was also able to add the manual excerpt function and tighten the line spacing as well.

    Great!

    In the manual excerpt box I added a line of html to add a “read more” link at the end of my content. Do you know if this is the best way to display a read more link? Can I use html (it helps keeps things simple) or does a function need to be added to my functions file?

    There are some snippets you can use to do this in your functions file instead. You can see an example here:

    https://codex.wordpress.org/Excerpt#How_to_add_a_link_beneath_an_excerpt_to_the_full_post

    One final question – if I add any css changes going forward, is it better to enter the css code into the ‘edit css’ on my dashboard or is it better to add the code to my style.css sheet? (or does it not matter?)

    It definitely matters so it’s good that you asked. 🙂

    You should add custom CSS to your child theme’s style.css. And just to be clear, you only add CSS there to override the styles in the parent theme – you don’t copy the entire parent stylesheet in there.

    Don’t edit your parent theme via the Edit CSS area in your dashboard, or you’ll lose all your changes every time you update the theme to the latest version.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to change the text under portfolio images on homepage’ is closed to new replies.