• Resolved Hamlet_PL

    (@hamlet_pl)


    HELLO,
    I have BIG problem with theme. I have script in header and style=”..” in footer and add some function in function php BUT:

    WHEN I MAKE UPDATE I MUST PASTE AGAIN COIDE TO THIS FILES..

    That is so boring and problematic.. Dear Nicolas can you make something with this?
    When u update version Hueman the someone users cant use your theme bc they are lost their own script!
    Thats BIG BUG!

    regards..

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hi Hamlet_PL. There have been some syntax and file location changes in the new version. If you’re using theme files and/or functions in a child theme you may need to copy the new theme files into your child theme and apply the same updates. If you have modified theme files or functions and you can list them here, I can help identify the new versions for you.

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    OK,

    My modified files are:
    directory: css/bbpress.css (bbpress that is file with style forum)
    file: header.php
    file: footer.php
    file: function.php

    Directory css/bbpress.css has to be not moving/deleting.

    Header (belowe my add code):

    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Dancing+Script" />
    
      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    
      <style type="text/css">
      #idletimeout { font-weight:bold }
      </style>
    
      <?php
      $mystring = "$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
      $findme   = 'HELLO WORLD';
      $pos = strpos($mystring, $findme);
      if ($pos === false) { } // Note our use of ===.  Simply == would not work as expected
      else {
        $user = wp_get_current_user();
        $allowed_roles = array('subskrybent2', 'subskrybent3', 'administrator');
        if( array_intersect($allowed_roles, $user->roles ) ) { }
        else {
          wp_redirect( home_url() ); exit;
        }
      }
    
      if( is_user_logged_in() ) {
        print('
        <style>
        #countdown { font-style: normal; }
        </style>');
      }
      if ( is_page( 'login' ) ) {
        print('hello world');
      }?>
    
    NEXT IN HEADER:
    <div class="countdown"><?php if( is_user_logged_in() ) { echo "GREAT"; } ?></div>
    
    NEXT AFTER HEADER:
    <div id="idletimeout">
              <p>Hello user</p>
            </div>
    
    ITS ORYGINAL Hueaman CODE:
    <?php $_header_img_src = hu_get_img_src('header-image'); ?>
            <?php if ( ! $_header_img_src || empty( $_header_img_src ) ): //@fromfull to keep ?>
    
              <div class="group pad">
                <div style="float: left; display: block;">
                  <?php echo hu_site_title(); ?>
                </div>
                <?php if ( hu_is_checked('site-description') ): ?>
                  <div>
                    <p style="line-height: 28px; font-family: Dancing Script;">Regon:</p>
                  </div>

    Footer (belowe my add code):

    <section class="container" id="footer-widgets" style="background-color: #eaeaea;">
    
    NEXT IN FOOTER:
    <div id="credit" style="<?php echo ! hu_is_checked( 'credit' ) ? 'display:none' : ''; ?>"> <p><?php _e('Wszystkie prawa zastrzeżone.'); ?></p> </div><!--/#credit-->

    Function (belowe my add ALL code):

    <?php
    //do not remove this
    
    /*
     * Get the most recently replied-to topics, and their most recent reply
     */
      function custom_bbpress_recent_replies_by_topic($atts){
      $short_array = shortcode_atts(array('show' => 5, 'forum' => false, 'include_empty_topics' => false), $atts);
      extract($short_array);
    
      // default values
      $post_types = array('reply');
      $meta_key = '_bbp_last_reply_id';
    
      // allow for topics with no replies
      if ($include_empty_topics) {
        $meta_key = '_bbp_last_active_id';
        $post_types[] = 'topic';
      }
    
      // get the 5 topics with the most recent replie
      $args = array(
        'posts_per_page' => $show,
        'post_type' => array('topic'),
        'post_status' => array('publish'),
        'orderby' => 'meta_value_num',
        'order' => 'DESC',
        'meta_key' => $meta_key,
      );
      // allow for specific forum limit
      if ($forum){
        $args['post_parent'] = $forum;
      }
    
      $query = new WP_Query($args);
      $reply_ids = array();  
    
      // get the reply post->IDs for these most-recently-replied-to-topics
      while($query->have_posts()){
        $query->the_post();
        if ($reply_post_id = get_post_meta(get_the_ID(), $meta_key, true)){
          $reply_ids[] = $reply_post_id;
        }
      }
    
      // get the actual replies themselves
      $args = array(
        'posts_per_page' => $show,
        'post_type' => $post_types,
        'post__in' => $reply_ids,
        'orderby' => 'date',
        'order' => 'DESC'
      );
    
      $query = new WP_Query($args);
      ob_start();
        // loop through results and output our rows
        while($query->have_posts()){
          $query->the_post();
    
          // custom function for a single reply row
          custom_bbpress_recent_reply_row_template( $query->current_post + 1 );
        }
      $output = ob_get_clean();
      return $output;
    }
    add_shortcode('bbpress_recent_replies_by_topic', 'custom_bbpress_recent_replies_by_topic');
    /*
     * Executed during our custom loop
     *  - this should be the only thing you need to edit
     */
    function custom_bbpress_recent_reply_row_template( $row_number ){
      // get the reply title
      $title = get_the_title();
    
      // trim title to specific number of characters (55 characters)
      $title = substr( $title, 0, 55);
    
      // trim title to specific number of words (5 words)...
      $title = wp_trim_words( $title, 5, '...');
    
      // determine if odd of even row
      $row_class = ($row_number % 2) ? 'odd' : 'even';
      ?>
        <div class="bbpress-recent-reply-row <?php print $row_class; ?>">
          <div><a href="<?php bbp_reply_url( get_the_ID() ); ?>"><?php print $title; ?></a></div>
          <div><?php print human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' temu'; ?></div>
        </div>
      <?php
    
      // Refs
      // http://codex.wordpress.org/Template_Tags#Post_tags
      // http://codex.wordpress.org/Function_Reference/get_avatar
      // http://codex.wordpress.org/Function_Reference/human_time_diff
      // (template tags for bbpress)
      // https://bbpress.trac.wordpress.org/browser/trunk/src/includes/users/template.php
      // https://bbpress.trac.wordpress.org/browser/trunk/src/includes/replies/template.php
    }
    // allow shortcodes to run in widgets
    add_filter( 'widget_text', 'do_shortcode');
    // don't auto-wrap shortcode that appears on a line of it's own
    add_filter( 'widget_text', 'shortcode_unautop');
    
    // Add logout popup
    function popup_js() {
    	 if ( is_page( 'login' ) ) {
    	 	if ( !is_admin() ) {
    	 		wp_register_script('popup_logout',get_template_directory_uri().'/js/popup_logout.js', false);
    	 		wp_enqueue_script('popup_logout');
    	 	}
    	}
    }
    add_action( 'wp_enqueue_scripts', 'popup_js' );
    
    // ShowPrivateFile
    function ShowPrivateFile() {
    	$user = wp_get_current_user();
    	$output='';
    	$allowed_roles = array('subskrybent2', 'subskrybent3', 'administrator');
    	if( array_intersect($allowed_roles, $user->roles ) ) {
    		$output = 'Pliki dostępne tylko po zalogowaniu:</br>'.'</br><a href="https:/XXXXXXXX.pl/wp-content/uploads/Document/abcd.docx">Protocol.docx</a></br>'.
    	}
    	return $output;
    }
    add_shortcode("pokaz_prywatne_pliki", "ShowPrivateFile");
    ORYGINAL CODE FROM HUEMAN:
    load_template( get_template_directory() . '/functions/init-core.php' );
    
    /**
    * The best and safest way to extend the Humean WordPress theme with your own custom code is to create a child theme.
    * You can add temporary code snippets and hacks to the current functions.php file, but unlike with a child theme, they will be lost on upgrade.
    *
    * If you don't know what a child theme is, you really want to spend 5 minutes learning how to use child themes in WordPress, you won't regret it :) !
    * https://codex.wordpress.org/Child_Themes
    *
    */

    So could u Tell me what I shoild do with it if I dont want to paste code always after update?

    If those files are in a child theme, none of them will be overwritten on a theme update. However, for the new version, you’ll need to copy out the changes you have made to header.php and footer.php, copy the new header and footer files from the parent theme to your child theme, then reapply your changes. If you’re not currently using a child theme you can download one from the theme web site.

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    Nope. I used parent Hueaman file. Now I see child file but I dont know how use it. I paste part of my code to the child but what next? where move this child file (place where should be this childs file) and how import child to the parent (oryginal) File?

    If you modified the actual theme files, and those files are in the v3 theme, copy the modified header.php and footer. php from the parent theme to your child theme folder. Your site will use the child theme files by default. The next time you apply a theme update the header.php and footer.php files in the parent theme folder will be overwritten but the files in your child theme won’t be affected.

    Same thing with functions.php, but don’t copy the entire parent theme functions.php file to your child theme. The child theme should already have an empty functions.php file so just copy the functions you added in the parent theme functions.php to the child theme functions.php file. Then remove your custom functions from the parent theme functions.php file.

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    Where is child theme folder?

    Page-templates?

    Did you download the child theme from the theme web site?

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    yes.
    I dowload from:
    https://github.com/presscustomizr/hueman-child/archive/master.zip

    After unzip I have this file: hueman-child-master.

    In this directory I have the following files:
    function.php
    screenshot
    style.css

    so If I understood correctly we edit this file and where paste those files?

    First you need to add the child theme and activate it (if you haven’t already done that).
    1. Install the new child theme in your Admin panel by selecting Add New > Upload Theme > Choose File, then select the zip file you downloaded.
    2. Activate the child theme.
    You’ll now have a pre-configured child theme with a style.css file and functions.php file to which you can add customizations.
    Note: since each theme identifies sidebars and menus using unique IDs you may need to reset your sidebars and menus.

    Then, using cPanel or FTP, connect to your host and copy the header and footer files from the parent theme folder to the child theme folder. This is all done on your host, not in the unzipped theme folder on your local computer.

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    OK, one genereal question.
    In first point: when I am in admin panel Do I upload master.zip from: https://github.com/presscustomizr/hueman-child/archive/master.zip
    or another file?
    Second. How activate it?

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    I’ll try to test more tomorrow.

    Big Thanks for help 🙂

    Do I upload master.zip from: https://github.com/presscustomizr/hueman-child/archive/master.zip

    You would download that file to your local computer. It should show up on your computer as “hueman-child-master.zip”. Then follow step 1 above.

    How activate it?

    In the admin panel Appearance > Themes, you’ll see the child theme. Hover over it and click Activate.

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    Great and exact answer bdbrown. Step by step.
    Ok, I Activate it. Below ifno about activated theme:

    Hueman ChildWersja 1.0.0
    
    Autor: You
    
    Sample child theme for customization.

    Next when I am in child theme folder via FTP on my webserver then I paste below files?

    file: header.php
    file: footer.php
    file: function.php
    Directory css/bbpress.css

    After copy/paste above files I have to remove my custom code from the parent theme file or delete this parent file?
    regards

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    Note: since each theme identifies sidebars and menus using unique IDs you may need to reset your sidebars and menus.

    Ok If I everything well done, now I haven’t see admin bar and pop-up. So how can I restart this sidebars?

    Thread Starter Hamlet_PL

    (@hamlet_pl)

    Here is my site:
    I added it:
    https://kovshenin.com/2014/child-themes-import/ in fuction.php and after removed @include in style.css but still not working..

    Exactly i dont see <div id=”wpadminbar” class=””></div>
    and
    I have problem with footer:
    Parse error: syntax error, unexpected end of file in /home/users/wm-marsa/public_html/wm-marsa.pl/wp-content/themes/hueman-child-master/footer.php on line 103

Viewing 15 replies - 1 through 15 (of 20 total)

The topic ‘After update everything is drop..’ is closed to new replies.