• Resolved ivanisevic82

    (@ivanisevic82)


    Good morning,
    I’m testing this plugin to add a subtitle to my web pages.
    It works great, congratulations to who made it!
    However I have two problems that I would like to be able to solve.

    1) I need to exclude the plugin from a specific page (in my case the Home page).
    I couldn’t find anything in the settings to exclude a particular page.
    I could do the opposite, listing all the pages where I want it to be displayed…however this would make the plugin lose much of its usefulness and convenience.
    Do you have solutions to suggest me?

    2) The plugin can be activated individually for pages, for posts or both.
    I decided to activate it only for pages and not for posts.
    However I noticed that in the html code the title and subtitle elements added by the plugin are still inserted in the code, even in the posts, but they are not visible.
    This is a problem because even if you don’t see them, they still take up space on the web page.
    In fact, the other elements present in the page are moved down, as for the “title” element (which is not seen, but is present in the html), I have assigned a padding-top in the css style sheet.
    Do you have solutions to suggest for this second and important problem?

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ivanisevic82

    (@ivanisevic82)

    I’m editing my post adding an update: I managed to solve the problems listed above, simply by inserting the part of the code related to adding titles and subtitles in “page.php” file, instead of “header.php”.

    Originally I had title and subtitle position in the header because they will be displayed in that area of the page.

    However, to solve the problema that I had title and subtitle in ALL the pages of the site (since header.php is called in every page), I was forced to insert title and subtitle in page.php and to work on the css in order to style correctly the position of the elements in the header, using a negative margin-top.

    I would like to know if this solution seems correct to you.

    Also I still need support for a second problem.

    I would like to be able to integrate title and subtitle in posts as well (and not only in the pages)

    These elements has to be displayed in the header, as happens in the pages, with the title (H1) and subtitle (H2) style.

    However, there is a problem in the posts that does not occur in the pages.

    In fact, when I enter a title on the pages, this is not displayed by default on the web page, therefore I only correctly display the title called by the PHP function “the_title” (in addition to the subsequent “get_secondary_title”). Conversely, when I insert the title into a post, wordpress AUTOMATICALLY creates an H1 element which it inserts into the page.

    In this way I have a duplication of titles: the first one called by the “the_title” function; the second inserted automatically by wordpress.

    However, I don’t want to forcibly delete the wordpress H1 title, as it would not only delete the post header, but also all the other titles (for example those listed in the post archive).

    How can I solve this problem?

    Thanks again for the support!

    Plugin Author thaikolja

    (@thaikolja)

    Hi @ivanisevic82,

    That’s a lot to unpack, I’m sorry. Can you, in short terms, summarize how I can reproduce your problem? This makes it a lot easier and faster to change anything. Thank you!

    Thread Starter ivanisevic82

    (@ivanisevic82)

    Hi, I fixed it!

    Actually the “h1” tag containing the title was not formed automatically in each post by WordPress, but it was part of my code present in single.php

    I just deleted it and fixed the problem.

    The plugin works great, thanks a lot!

    I’m left with just a little fear: this plugin is very important for my site because I’ve changed a big part of the structure of my theme according to the subtitle that I can implement thanks to this plugin.

    I wonder: if in the future the creator no longer supports the plugin or withdraws it from wordpress, would I risk having to completely modify my site?

    Or in the event that the creator wants to withdraw it from wordpress, once downloaded and activated on my site it can no longer be removed and the only problem will be not having it updated anymore?

    Thanks again for the assistance!

    Plugin Author thaikolja

    (@thaikolja)

    Wow, those are good news! Glad you could figure it out so fast.

    Regarding your fear: As long as you have Secondary Title installed and activated, nothing should go wrong. Unfortunately, some (child) themes like to tinker with the get_title() filter and overwrite the title format. In this case, the only way to get it solved is by deactivating “Auto insert” and using PHP at the locations where you’d like title to be displayed.

    To make sure your site won’t break without the plugin, don’t forget to set up some fallbacks. E.g., this:

    if(defined('SECONDARY_TITLE_VERSION')) {
       // We can now safely assume that Secondary Title is working
    }

    To be honest, I don’t see the need for any urgent updates at the moment. I’ve been thinking about rebuilding it, v3, entirely from scratch and with faster and more reliable technology. But this is, so far, just an idea with no concrete plans yet (feel free to throw in some ideas).

    In the case that the developer, I, dropped out: I’m a helpful guy. If you email me with a bug or small adjustment, I love helping, even if the plugin has reached its end of life and won’t receive another version cycle.

    In short: Don’t worry. You don’t have to remove anything. Just download Secondary Title as plugin, activate it, fine-tune it in the plugin’s settings page under “Settings”.

    One thing you should know: Even if Secondary Title is destroyed or whatever: You can still display the titles. Use this fallback code:

    if(!defined('SECONDARY_TITLE_VERSION)) {
       $post_id = get_the_ID();
       // No Secondary Title active, display with alternative method
    
       function get_secondary_title() {
          return get_post_meta('_secondary_title', true);
       }
    }

    By the way, all code here is untested, so maybe you run into a syntax error because I forgot to close an if statement or so, but you can easily fix it.

    So, the important thing to remember: Your secondary title is saved inside a post as a custom post meta named _secondary_title (note the underscore in front).

    Thread Starter ivanisevic82

    (@ivanisevic82)

    Many thanks Thaikolja, everything is clear!

    I have only one doubt left: I read in your replay that some problems could occur only in the use of some child themes, I think perhaps as a result of an update.

    Since I don’t use third-party themes but only a theme made by me (non-child), can you confirm that that remote risk doesn’t exist in my case?

    Thanks again!

    Plugin Author thaikolja

    (@thaikolja)

    No problem, that’s what I’m here for ??

    And if your website is fully customized, you don’t have to be afraid of updates breaking anything. Your theme will not ask you to update the version number in the main plugin .php file to a higher, fictional version, e.g., 3.0.0 or something. But this is only necessary if your theme has the same name/slug as one that’s already been hosted on www.remarpro.com.

    The plugin itself can and should be updated. Unfortunately, there’s always a very slight chance that the rollout of a new version can cause WP installations in very old, out of date websites. That includes WP core as well as plugins. Keep ’em fresh!

    Have I answered everything, or did I miss anything? If you’re happy with what I offer, I’m always glad for a nice review ??</img>

    • This reply was modified 1 year, 10 months ago by thaikolja.

    I got the same problem and I can’t solved. I just want the second title on the post not in the grid post of the home page or in the categories etc. i just want it in the post. I click just in the post types: Post but appears everywhere.

    I use Elementor Pro and Astra theme

    Thanks

    • This reply was modified 1 year, 6 months ago by Replicante.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Excluding subtitle from a specific page and problem when excluded in post’ is closed to new replies.