Coder Social home page Coder Social logo

Early return filter about subtitles HOT 6 CLOSED

wecobble avatar wecobble commented on July 17, 2024
Early return filter

from subtitles.

Comments (6)

philiparthurmoore avatar philiparthurmoore commented on July 17, 2024

Hi Oliver,

This makes sense. I assume that you've solved this issue by modifying the code on your end? I'm going to leave this Issue open and patch the plugin. It's a good suggestion.

Cheers!

from subtitles.

webmandesign avatar webmandesign commented on July 17, 2024

Hi Philip,

I'm ashamed as I haven't tried it before. I've done it now and it doesn't work actually. I will do some editing and will let you know about the best solution I've come up with in a while ;)

Regards,

Oliver

from subtitles.

philiparthurmoore avatar philiparthurmoore commented on July 17, 2024

Sounds good Oliver. When I have some time I'll do some testing on my end as well. I hope to have some time for the plugin this weekend. Cheers.

from subtitles.

webmandesign avatar webmandesign commented on July 17, 2024

Hi Philip,

I have done some test and it would be actually too complicated to add this functionality into your plugin I guess. I wasn't able to come up with a good solution via changing the code in the plugin. The thing is that the $post variable is being taken from the first post in the loop. This would then determinate when the plugin return early (depending on whether the first loop post has subtitle set up).

And as you might noticed already, the page_for_posts heading would be displayed outside the main loop anyway, so the plugin would return early.

But there is a very easy simple solution for this that your plugin already offer. And simplest solutions are the best ;) So, I ended up adding the subtitle to a blog page title with your get_the_subtitle( $page_for_posts ) function. Something like this:

// This is page title outside the main loop
if ( is_home() ) {
 $title .= ' <span class="entry-subtitle">' . get_the_subtitle( absint( get_option( 'page_for_posts' ) ) ) . '</span>';
}

So, thank you for help, but the issue is resolved and I think there is no need to change the plugin for this ;)

Regards,

Oliver

from subtitles.

philiparthurmoore avatar philiparthurmoore commented on July 17, 2024

Awesome Oliver! That's a perfectly fine solution that you've proposed. I like it. :) Thanks for letting me know.

from subtitles.

philiparthurmoore avatar philiparthurmoore commented on July 17, 2024

I should have thought of that also. :-P

from subtitles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.