How to change 'follow me' text on Twitter widget

  • Mod

    Kenneth John Odle

    #15885

    Read this page in the codex for more info about child themes and functions.php. I found it very helpful.

    Ken

    jrothra

    #15886

    Ken,

    I did read that page and it was a bit confusing, especially since it seemed to focus on the CSS file, and my questions are more about the other files. Also, it tends to be a bit technical, a downside to WP “walkthroughs” for those of us not as familiar with coding language. Syahir, though, has been extremely helpful and seems to try to explain things in terms we can all understand. ๐Ÿ™‚ For that I’m very grateful.

    jrothra

    #15887

    Would the same rules apply to the loop.php and footer.php files as do to the functions.php file that you mentioned above (don’t add it all, just what I customize). If so, since my customizations in the loop.php are moving the location of the top social share buttons, and in the footer it’s adding a custom menu, how would I do that?

    Here’s my customizations (areas affected shown since that’s all I’ve changed):

    Loop.php File Changes

    Notice I’ve marked where the new location is as well as where the original location was, just for my future reference.

    <?php /* Post content */ ?>
    <!-- SOCIAL SHARING TEST LOCATION START -->
    <div id="socialsharing">
    <?php /* Social sharing buttons at top of post */ ?>
    <?php if (stripos($graphene_settings['addthis_location'], 'top') !== false) {graphene_addthis(get_the_ID());} ?>
    </div>
    <!-- SOCIAL SHARING TEST LOCATION END -->

    <div class="entry-content clearfix">
    <?php do_action('graphene_before_post_content'); ?>

    <?php if ((is_home() && !$graphene_settings['posts_show_excerpt']) || is_singular() || (!is_singular() && !is_home() && $graphene_settings['archive_full_content'])) : ?>

    <!-- SOCIAL SHARING ORIGINAL LOCATION -->
    <?php /* The full content */ ?>
    <?php the_content('<span class="block-button">'.__('Read the rest of this entry ร‚ยป','graphene').'</span>'); ?>
    <?php else : ?>
    <?php /* The post thumbnail */
    if (has_post_thumbnail(get_the_ID())) { ?>
    <div class="excerpt-thumb">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'graphene'), the_title_attribute('echo=0')); ?>">
    <?php the_post_thumbnail(apply_filters('graphene_excerpt_thumbnail_size', 'thumbnail')); ?>
    </a>
    </div>
    <?php
    } else {
    echo graphene_get_post_image(get_the_ID(), apply_filters('graphene_excerpt_thumbnail_size', 'thumbnail'), 'excerpt');
    }
    ?>

    Footer.php Changes

    As with above, I’ve marked the beginning and end of what I’ve added.

    <?php if ( ! $graphene_settings['hide_return_top'] ) : ?>
    <li class="menu-item return-top"><a href="#"><?php _e('Return to top', 'graphene'); ?></a></li>
    <?php endif; ?>

    <!--ADDED BY JOHN START -->
    <li><a href="#">Control Panel</a>
    <ul class="sub-menu"><li><?php wp_register(); ?></li>
    <li><?php wp_loginout(); ?></li>
    <?php wp_meta(); ?>
    <!--LINK TO HOW TO VIDEOS FOR ADMINS ONLY-->
    <?php global $user_ID; if( $user_ID ) : ?>
    <?php if( current_user_can('level_10') ) : ?>
    <li><a href="http://www.greggcountygop.com/howto/">Instructional Videos</a></li>
    <?php endif; ?>
    <?php endif; ?>
    <!--END LINK TO HOW TO VIDEOS FOR ADMINS ONLY--></ul></li>
    <!--ADDED BY JOHN END -->

    </ul>

    </div>

    <div id="developer">
    <p>
    <?php /* translators: %1$s is the link to WordPress.org, %2$s is the theme's name */ ?>
    <?php printf(__('Powered by %1$s and the %2$s.', 'graphene'), '<a href="http://wordpress.org/">WordPress</a>', '<a href="http://www.khairul-syahir.com/wordpress-dev/graphene-theme">' . __('Graphene Theme', 'graphene') . '</a>'); ?><br />Customized by <a href="http://www.jrothraministries.com>" target="_blank">John L. Rothra</a>.
    </p>

    <?php do_action('graphene_developer'); ?>
    </div>

    In case you’re wondering why I have the code to limit a link to Admins only, I do have a plugin that will block a page or post to people unless they are logged in as a Admins. However, I don’t want the link to that page showing up at all unless the person is logged in as an admin. Whether the link was put in the regular menus or added to the Meta widget, it would be visible to anyone who logs in regardless of their level. I wanted to hide the link from anyone except admins, hence this coding.

    Admin

    Syahir Hakim

    #15888

    There are four types of files that can exist in your child theme.

    1. Files that must be there for the child theme to work

    This would be the style.css file. This file defines the name of your child theme and which parent theme is it using. This file is automatically loaded by WordPress when the child theme is activated. The parent’s theme’s style.css file however, will not be automatically loaded. That’s what the following line in the child theme’s style.css file is for:

    @import url("../graphene/style.css");

    2. WordPress template files

    These are the files that WordPress recognised as template files. You can see a list of files recognised as WordPress template files from this Codex page. In addition to those files, any other files that the parent theme includes by using the get_template_part() function belongs to this group of files as well. For example, the loop.php file.

    If any of the files above is present in the child theme’s folder, WordPress will automatically load those files, and it will not load the corresponding original files in the parent theme. This is the reason why you must copy the entire codes from the parent theme when adding files like footer.php or header.php into your child theme.

    3. The special functions.php file

    This is a special WordPress-recognised template file. It will be automatically loaded way before any other template files is loaded. It’s used for a lot of purposes, such as defining new PHP function and setting up certain features for the theme.

    This file is optional. Your child theme can work wihout this file, but if it is present, it will be loaded automatically. Unlike the other template files, when this file exists in your child theme, WordPress will load both the child theme’s functions.php file and the parent theme’s functions.php file. That is the reason why you should not copy the entire codes from the parent theme’s functions.php file.

    4. All other files

    All other files apart from those described above will not be loaded, unless it is explicitly included in the other automatically-loaded files.

    jrothra

    #15889

    That makes more sense to me that WP’s explanation. ๐Ÿ™‚

    jrothra

    #15890

    Wondering something. If I place the footer.php, loop.php, or header.php files in the child theme, what impact will that have later if I go to update the parent theme? Will I have to then re-edit the updated footer, header, loop?

    Admin

    Syahir Hakim

    #15891

    Unfortunately yes, or otherwise you’ll miss out on all the new code additions/fixes to those files. This is why you should never replace the theme’s template files in your child theme, unless it is absolutely necessary. Most of the time, you can use the child theme’s functions.php file and the many action and filter hooks available with the theme to customise it.

Viewing 7 posts - 11 through 17 (of 17 total)

  • 1
  • 2
  • You must be logged in to reply to this topic.