Support » Plugin: One Click Demo Import » Page title filter not working

  • Resolved ninetienne

    (@ninetienne)


    Tried to use the filter to change the page title:

    
    function ocdi_plugin_page_setup( $default_settings ) {
    	$default_settings['page_title']  = esc_html__( 'Theme Demos' , 'text-domain' );
    	return $default_settings;
    }
    add_filter( 'pt-ocdi/plugin_page_setup', 'ocdi_plugin_page_setup' );
    

    Doesn’t work, because the apply_filters is actually not there in the plugin πŸ™

    I would like to remove the dashicons from the title too. None of WordPress pages have a dashicon in the page title.

    Would highly appreciate your help. Thanks!

    • This topic was modified 3 years, 10 months ago by ninetienne.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    the page_title parameter in this filter is actually for the page title in the browser tab and it’s working just ok (just tested it).

    However you can change the whole page layout/content with another filter:

    
    add_filter( 'pt-ocdi/plugin_page_display_callback_function', 'ocdi_plugin_page_callback' );
    
    function ocdi_plugin_page_callback() {
    	return 'ocdi_plugin_page';
    }
    
    function ocdi_plugin_page() {
    	?>
    		<div class="ocdi  wrap  about-wrap">
    			<h1 class="ocdi__title"><?php esc_html_e( 'OCDI title change', 'pt-tr' ); ?></h1>
    			...
    		</div>
    	<?php
    }
    

    You can find the default plugin page HTML in the plugin files: /views/plugin-page.php

    Take care!

    Thread Starter ninetienne

    (@ninetienne)

    Sorry, didn’t notice that the filter was for the browser title.

    As for the settings page title, you suggest, that I should rewrite the entire page, just to change the settings page title? Including all the notices, errors, filters, demo items grid? πŸ™‚

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    no, I’m just saying, that if you don’t like certain things on the plugin page, you can change them.

    Use the default plugin page HTML in the file I posted above and just change the things you don’t like via the filter above.

    No rewrite needed, just the changes you want.

    Take care!

    Thread Starter ninetienne

    (@ninetienne)

    Yes, but I need to copy the entire HTML to change the title only.

    If there’s a plugin update and the HTML gets some changes too, I’ll have to copy it again and change the title again.

    There’re filters for the description, browser title, menu item, menu slug. Why wouldn’t you add a filter for the page settings title too?

    Plugin Author Gregor Capuder

    (@capuderg)

    That’s the current available option.

    I agree, that it’s not a good option, so I would like to ask you to open another GH issue here: https://github.com/proteusthemes/one-click-demo-import/issues and I’ll add the filter in the next update.

    Please also add the URL of this support ticket for reference in the GH issue.

    Take care!

    Thread Starter ninetienne

    (@ninetienne)

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    the plugin update with this added code was just released, so I will mark this ticket as solved.

    Take care!

    Thread Starter ninetienne

    (@ninetienne)

    Thanks a lot!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Page title filter not working’ is closed to new replies.