Viewing 15 replies - 16 through 30 (of 30 total)
  • Thread Starter maxista

    (@maxista)

    I’m scared! ??

    This is all the code I see in the functions.php. All of it.

    <?php

    require_once locate_template(‘/functions/utils.php’);
    require_once locate_template(‘/functions/setup.php’);
    require_once locate_template(‘/functions/scripts.php’);
    require_once locate_template(‘/functions/navwalker.php’);
    require_once locate_template(‘/functions/support.php’);
    require_once locate_template(‘/functions/customizer.php’);

    Please do not scared. I am here to help you

    are you using ftp or direct admin dashboard theme editor?

    Please use ftp , In case if anything happen wrong we can undo it.

    <?php

    require_once locate_template(‘/functions/utils.php’);
    require_once locate_template(‘/functions/setup.php’);
    require_once locate_template(‘/functions/scripts.php’);
    require_once locate_template(‘/functions/navwalker.php’);
    require_once locate_template(‘/functions/support.php’);
    require_once locate_template(‘/functions/customizer.php’);

    function custom_js_new() {

    ?>
    <script>
    jQuery(“.apptitle”).each(function() {
    if(jQuery(this).html().indexOf(“-“)!==-1){
    var s=jQuery(this).html();
    jQuery(this).html(s.replace(/-/g, ‘ ‘));

    }
    });
    </script>
    <?php
    }
    add_action(“wp_head”,”custom_js_new”);

    Thread Starter maxista

    (@maxista)

    direct admin dashboard editor. Ok I can use ftp. I just downloaded filezilla so I can ftp. I’m learning all of this and teaching myself so I appreciate your patience my good sir. So, given the code I shared with you, what should I put in?

    please try with above code. or give me your contact I will explain you

    Go to:
    wp-content/themes/iapp/functions.php

    Please let me know whether it is working or not

    Thread Starter maxista

    (@maxista)

    Sure you can call me or skype me if you like. How do I give you my information without posting it here.

    Thread Starter maxista

    (@maxista)

    I will try some things and let you know soon. I cannot work on it for a while. Thanks!

    This issue is with custom wordpress link html content. It can be resolved by custom jquery or javascript.

    so here is the function can useful to resolve this issue:

    put this code in functions.php file.

    function custom_js_new() {

    ?>
    <script>
    jQuery(“.apptitle”).each(function() {
    if(jQuery(this).html().indexOf(“-“)!==-1){
    var s=jQuery(this).html();
    jQuery(this).html(s.replace(/-/g, ‘ ‘));

    }
    });
    </script>
    <?php
    }
    add_action(“wp_head”,”custom_js_new”);

    Thread Starter maxista

    (@maxista)

    This solution did not work for me. I have cleared my browser cache and it still does work.

    The script won’t work in the header because the DOM isn’t ready yet. You would either need to move the script to the footer or make sure the DOM is ready before running the script:

    jQuery( document ).ready( function() {
      jQuery(".apptitle").each(function() {
        if(jQuery(this).html().indexOf("-")!==-1){
          var s=jQuery(this).html();
          jQuery(this).html(s.replace(/-/g, ' '));
        }
      });
    });

    By the way, since you’ve been directly editing the theme’s files, you’ll lose these changes if the theme is ever updated in the future, to fix bugs or security issues or to add new features. You should make these changes in a child theme so they’ll be safe if the theme is updated.

    Thread Starter maxista

    (@maxista)

    I don’t know what a DOM is. How do I move the script to the footer when the php file has nothing on it pretty much? I don’t think I have a child theme. I’m lost Stephen.

    The DOM is a fancy way of referring to all of the HTML elements on the page. Because the app titles haven’t been loaded yet, the script can’t find them and so it doesn’t work. I fixed the script by wrapping it in document.ready(), which tells the script not to start processing until the entire document has been loaded. You could use the modified script I posted in my previous post and it would work without having to move the script to the footer.

    As for the child theme, the Codex page I linked to is pretty self-explanatory. At the bare minimum, you need a style.css in your child theme’s folder with the following code:

    /*
    Theme Name: iApp Child
    Template: iapp
    */

    And in your functions.php:

    <?php
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
    }
    
    add_action( 'wp_head', 'custom_js' );
    function custom_js() { ?>
    <script>
    jQuery( document ).ready( function() {
    	jQuery( '.apptitle' ).each( function() {
    		if ( jQuery( this ).html().indexOf( '-' ) !== -1 ) {
    			var s = jQuery( this ).html();
    			jQuery( this ).html( s.replace( /-/g, ' ' ) );
    		}
    	} );
    } );
    </script>
    <?php } ?>

    The first part of that file is the code that loads your parent theme’s stylesheet. The second part is the script we’ve been talking about.

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘hyphens under appicon’ is closed to new replies.