Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   [SOLVED] More option comment numbering on Byline. (http://forum.bytesforall.com/showthread.php?t=20166)

giacinto Apr 20, 2013 04:26 AM

[SOLVED] More option comment numbering on Byline.
 
Good morning and congratulations for the great theme.
In wp-includes (comment-templates.php) I changed the original function comments_number in order to have a fifth option ($ zero = false, $ one = false, $ less = false, $ more = false, $ deprecated = '').
The code works fine on the pages of posts.
What I ask is: how do I implement the same function to have the vision of the counts even in the setting of the byline?.
I use Ata 3.7.10 and wp 3.5.1
Thanks

juggledad Apr 20, 2013 04:44 AM

you'll probably have to edit bfa_postinfo.php but first I'd suggest you upgrade to 3.7.12

giacinto Apr 20, 2013 05:22 AM

Thanks kind Mr. Juggledad.
Honestly though, I can not proceed. Can you be so kind as to tell me exactly where and what to change?.
Thanks

juggledad Apr 20, 2013 06:29 AM

not really, not without knowing what you did to comment-templates.php and then spending a lot of time looking at the interaction.

This is not a theme issue and beyond what I'm willing to do for free because of how much of my time would be involved.

If you aren't capable of doing this, I suggest you advertise and see if you can hire someone to do it or rethink the need for this.

giacinto Apr 20, 2013 06:59 AM

2 Attachment(s)
What you wrote is correct and I can not pretend, of course.
I hope that seeing the changes that I have made, you can guess if the problem is solved or not.
Thanks anyway gentle Mr. Juggledad.

Code:

function comments_number( $zero = false, $one = false, $less = false, $more = false, $deprecated = '' ) {
        if ( !empty( $deprecated ) )
                _deprecated_argument( __FUNCTION__, '1.3' );

        $number = get_comments_number();
        if ( $number > 1 && $number <12 )
                $output = str_replace('', number_format_i18n($number), ( false === $less ) ? __(' Comments') : $less);
        elseif ( $number >= 12 )
                $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
        elseif ( $number == 0 )
                $output = ( false === $zero ) ? __('No Comments') : $zero;
        else // must be one
                $output = ( false === $one ) ? __('1 Comment') : $one;

        echo apply_filters('comments_number', $output, $number);

...and others little pieces of code.

Two of the results are these:

giacinto Apr 22, 2013 05:49 AM

Good afternoon Mr. Juggledad,
really you can't help me, just only addressing me on the right way?.
I'm sure that the others guys like the adding option.
Please!.
Best regards

juggledad Apr 22, 2013 06:37 AM

You are looking for a custom modification to the theme. This is beyond the scope of this forum.

I suggest you hire someone to do it for you.

giacinto Apr 23, 2013 02:11 AM

Right!.
Thank you Mr. Juggledad!.

giacinto Apr 26, 2013 03:33 AM

Good morning, kind Mr. Juggledad.
It was not really that hard. All it took was fiddling about thirty minutes and at the end I got what I wanted, without losing, in fact, long time.
I think that a capable person like you, would solve the problem in two minutes and would not have engaged for hours, as you had written.
Sometimes it would be advisable not stick exclusively for the purposes of the forum, because we are all "in the same boat."
Have a wonderful day!.

juggledad Apr 26, 2013 03:48 AM

so why don't you share your solution for others?

giacinto Apr 26, 2013 05:17 AM

Hello gentle Mr. Juggledad.
I didn't it, because you wrote that the question that I have submitted, is not part of the interest of this blog!.

juggledad Apr 26, 2013 05:33 AM

I said it wasn't a theme issue and I wasn't willing to dig into it.

Bbut since you have figured it out, why not share your solution with others on the forum. Write up a detailed explaination of what you did...after all isn't that what you wanted me to do?

giacinto Apr 26, 2013 07:13 AM

All right!.
My little need came from the desire to highlight the items with a substantial number of comments.
As I described before, the function should give me back not 4 but 5 conditions: 0, 1, >1 and <?​​, >?.
First I find the function 'comments_number' in wp-includes/comment-template.php, and I laid down the conditions as in the following pieces of code.
Code:

function comments_number( $zero = false, $one = false, $less = false, $more = false, $deprecated = '' ) {
        if ( !empty( $deprecated ) )
                _deprecated_argument( __FUNCTION__, '1.3' );

        $number = get_comments_number();
        if ( $number > 1 && $number <12 )
                $output = str_replace('', number_format_i18n($number), ( false === $less ) ? __(' Comments') : $less);
        elseif ( $number >= 12 )
                $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
        elseif ( $number == 0 )
                $output = ( false === $zero ) ? __('No Comments') : $zero;
        else // must be one
                $output = ( false === $one ) ? __('1 Comment') : $one;

        echo apply_filters('comments_number', $output, $number);
}

...after

Code:

function comments_popup_link( $zero = false, $one = false, $less = false, $more = false, $css_class = '', $none = false ) {
        global $wpcommentspopupfile, $wpcommentsjavascript;

        $id = get_the_ID();

        if ( false === $zero ) $zero = __( 'No Comments' );
        if ( false === $one ) $one = __( '1 Comment' );
        if ( false === $less ) $less = __( ' Comments' );
        if ( false === $more ) $more = __( '% Comments' ); 
        if ( false === $none ) $none = __( 'Comments Off' );

....

...after

Code:

....
        echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
        comments_number( $zero, $one, $less, $more, $none );
        echo '</a>';
....

After that I changet too the bfa_postinfo.php in the folder functions in Atahualpa Theme at the position of the below code:

Code:

....
                        $comment_options = preg_match("/(.*)%comments\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i",

                $postinfo_string,$comment_matches);

       

                        if ( !comments_open() AND $comment_matches[10] == "dontshow" ) {

                                $comment_link = '';

                        } else {

                                ob_start();

                                        comments_popup_link($comment_matches[2], $comment_matches[4],

                                  $comment_matches[6],        $comment_matches[8], 'comments-link', $comment_matches[10]);

                                        $comment_link = ob_get_contents();

                                ob_end_clean();

                        }



                        if (!comments_open() ) {

                                if ($post->comment_count == 0) {

                                        $comment_link = '<strong>' . $comment_matches[10] . '</strong>';

                                } else {

                                        $comment_link = $comment_link . ' - <strong>(' . $comment_matches[10] . ')</strong>';

                                        }

                        }

                        if ( !comments_open() AND $comment_matches[10] == "dontshow" ) {

                                $comment_link = '';

                        }
....

On BYLINE of Homepage and Multi Post Pages I put the following code:
Code:

....
%comments('  <image(comment.gif)> 0 ', '  <image(comment.gif)> 1 ', '  <image(comments.gif)> ', '  <image(comments.gif)>  %  and some other thing, just for to point out the post ', ' ')%
....


That's all!.
-------------------
I made also some variations in the comment.php, but for to show what I posted already and you can see on the above pictures.

giacinto Apr 26, 2013 07:16 AM

Hello gentle Mr. Juggledad,
What do you think of this?.
Friendliness

juggledad Apr 26, 2013 07:19 AM

Good job! hopefully someone else may find this helpful.

btw don't forget that the next time you update WordPress or the theme you will have to redo part or all of this.

giacinto Apr 26, 2013 07:25 AM

Hello gentle Mr. Juggledad,
Thank you... I keep in my mind your suggestions!.
A next.
Bye


All times are GMT -6. The time now is 01:44 AM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.