WordPress.org

Forums

BE Subpages Widget
[resolved] Alternate link title (4 posts)

  1. ashtonej
    Member
    Posted 1 year ago #

    Hi Bill,

    Is there a way to override the link title in the BE subpages list?

    Some of my page titles are long and I'd prefer a shorter link title.

    For example:

    Madrid four week TEFL course (parent)
    Madrid four week TEFL course description (child page title)
    Madrid four week TEFL course syllabus (child page title)

    I really do not want to shorten the child page titles as they are descriptive to a reader that lands on them, Google optimised and doing OK.

    I don't have a problem with the parent page but it would e nice to show the child with a shorter but understandable title, for example:

    Madrid four week TEFL course (parent)
    Course description
    Syllabus
    etc.

    Is this possible? If it is, do you have an example of how to implement it?

    Thanks,

    Jim

    https://wordpress.org/plugins/be-subpages-widget/

  2. ashtonej
    Member
    Posted 1 year ago #

    Hi Bill,

    I figured something out but just want to check what will happen in the future.

    I added post meta using a key of be_alt_link_title.

    I then did a direct modify on the BE Subpages php program by adding:

    $alt_title = get_post_meta($parents[0], "be_alt_link_title", $single);
    
    if ($alt_title[0] > "")
    {
    	$title = $alt_title[0]; // top title
    }

    just before the echo for the top item.

    And also the following just before the echo to the subpages.

    $alt_title = get_post_meta($subpage->ID, "be_alt_link_title", $single);
    
    if ($alt_title[0] > "")
    {
    	$subpage->post_title = $alt_title[0]; // sub title
    }

    Can my modified code run as child (like with a child theme) or will I have to save the code and re-install it when you release a new version of BE Subpages?

    Is it worth adding as an option to the current widget?

    Thanks,

    Jim

  3. Bill Erickson
    Member
    Plugin Author

    Posted 1 year ago #

    Do not directly modify the plugin. When an update comes out, your changes will be lost.

    I've added a filter that allows you to customize the title. Download the development version of the plugin here ( https://github.com/billerickson/BE-Subpages-Widget/archive/master.zip ). Then add this to your theme's functions.php file: https://gist.github.com/billerickson/eae1345d8df6c45c47aa

  4. ashtonej
    Member
    Posted 1 year ago #

    Thanks Bill.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • BE Subpages Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic