• Resolved romymk

    (@romymk)


    Thank you for this plugin. I was able to successfully use it to add subheadings to pages and posts within a website. However, today I was editing a post and realised the field no longer displays in the editor.

    For secondary titles previously posted, the titles are still displayed on the front-end of the website, just not in the editor.

    Any ideas why this may be happening? There haven’t been any major changes to the site other than updates.

    Thanks much.

    https://www.ads-software.com/plugins/secondary-title/

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Have you added any plugins? Check the Google Chrome console for errors. Check the Secondary Title’s settings page.

    Thread Starter romymk

    (@romymk)

    No. I didn’t add new plugins. Just updated existing ones. I will start disabling plugins to check for conflicts, and keep you posted when it’s resolved.

    Plugin Author thaikolja

    (@thaikolja)

    Thanks. If it’s a problem with my plugin, I’ll fix it right away.

    Hi thaikolja, I have the same problem but it happened after I added a new plugin, Yoast. When I deactivate Yoast, then the Secondary title shows again in the Editor. Do you know what’s the problem? Thanks a lot for your help! ??

    Plugin Author thaikolja

    (@thaikolja)

    Please tell me what versions (WP, Secondary Title, Yoast) you’re using. If you use Google Chrome, please check your developer console for errors (marked in red).

    Sure, I’m using WP 4.5.3 / Yoast 3.4.2 / Secondary Title 1.9.0.

    I don’t use Google Chrome but Firefox.

    Everything worked fine until I installed Yoast… When I deactivate it, then Secondary Title field shows up again in Editor.

    I hope it helps!

    Plugin Author thaikolja

    (@thaikolja)

    I checked with your setup on both Firefox and Chrome, and both worked well. Do you have any other plugins activated? If yes, have you tried deactivating all plugins except the two? And what is your OS?

    I must be able to reproduce the error, otherwise I can’t fix it ??

    I’m on Windows. Maybe this can help: the Secondary Title field is still showing for the Admin user (with Yoast activated) but it doesn’t show up anymore for other users… Weird, isn’t it?

    Alright, I find out what caused Secondary Title field not showing anymore: it’s a code I added in my functions.php to hide Yoast meta box:

    function so_remove_wp_seo_meta_box()

    I don’t know why it was the problem (I don’t code at all) but I removed it and now Secondary Title works perfectly again.

    Sorry for the bother, your plugin is truly awesome and I appreciate a lot your quick reply! Thanks again ??

    Plugin Author thaikolja

    (@thaikolja)

    Thanks for your nice reply. If you show me what’s inside that function, I might be able to help you out there.

    You’re welcome, here’s the whole function:

    if ( !current_user_can('update_core') ) {
    	function so_remove_wp_seo_meta_box() {
    	    remove_meta_box( 'wpseo_meta', 'post', 'normal' );
    	}
        add_action( 'add_meta_boxes', 'so_remove_wp_seo_meta_box', 100000 );
    	add_filter( 'wpseo_use_page_analysis', '__return_false' );
    }
    Plugin Author thaikolja

    (@thaikolja)

    Oh, now I get it. Secondary Title uses jQuery to place the input field above/below (depending on your settings) the primary title. By removing Yoast’s meta box, his script breaks and automatically breaks all other scripts that are being executed after. That’s Yoast’s fault :p

    You can avoid this by removing the element with jQuery instead of PHP. Use setTimeout() to delay the script a bit until the SEO plugin has found the element:

    <?php
       function remove_wpseo_meta_box() {
          ?>
          <script>
             jQuery(document).ready(
                function () {
                   setTimeout(
                      function () {
                         jQuery("#wpseo_meta").remove();
                      }, 1000
                   );
                }
             );
          </script>
          <?php
       }
    
       add_action("admin_head", "remove_wpseo_meta_box");

    Or, even easier, use the “Screen Options” in the top right corner to disable the meta box:

    View post on imgur.com

    I hope I could help.

    Thanks a lot thaikolja, this new function sounds great but it broke my site, I got an all white page… Maybe it has something to do with the <script> tag inside the PHP code?

    The easier way would indeed be to use the Screen Options but it would be a ‘by user’ rule and I’d like it to be by default for every user.

    Plugin Author thaikolja

    (@thaikolja)

    Actually, a jQuery script can’t possibly break your site. Try add this to your theme’s .js file instead then, but only the inner content of the script tags. Some themes use $() instead of jQuery(), so make sure that you use the same as your theme.

    Edit: And note that my excerpt uses the PHP opening tag <?php which you might not need.

    I modified the function using echo to make it work and now it does exactly what it was supposed to do, thanks to you! Thank you for taking the time to reply so quickly and so effectively, much appreciated! ??

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Secondary Title no longer shows in editor’ is closed to new replies.