• Resolved ifelarry

    (@ifelarry)


    Hi Guys,
    Special Kudos to guys working endlessly to resolve people’s problem here especially d4z_c0nf, electricfeet, rdellconsulting etc.

    Here is my problem.
    I often write long posts, but i’ve been able to paginate using <!–nextpage–> (courtesy d4z_c0nf).
    However, i don’t like the way the page number looks here in this fertility massage post most people don’t even know the article has page 2.
    HOW CAN I STYLE THE NUMBERING TO SOMETHING LIKE THIS?

    Secondly, I want to use only the right side bar but the width of the content area seems to be too wide. Is there a way i can offset the content area without using the left sidebar?

    Thanks in anticipation.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Mmm the default customizr pagination isn’t as ugly as your one ??
    Did you change something in core files?
    Or applied some filter somewhere to make it that way?
    I suggest to revert those changes, and then we can start modding it ??

    Thread Starter ifelarry

    (@ifelarry)

    Thanks for the response. I believe you will eventually help me thru.
    I didn’t make any changes in the core files that i can remember (infact i’m a novice).

    Or do you think i should delete the theme and re-download it?
    Or is it possible a pluggin is messing with me?
    Please can we still resolve the problem even if i don’t know the changes i’ve made?
    However, these are the changes i have in the function.php of my child’s theme.

    //modify footer credits
    add_filter('tc_credits_display', 'my_custom_credits');
    function my_custom_credits(){
    $credits = '<a title="Terms of Service" href="https://naturalhealthbag.com/terms-of-service/">Terms of Service</a> | <a title="Privacy Policy" href="https://naturalhealthbag.com/privacy-policy/">Privacy Policy</a> | <a title="Sitemap" href="https://naturalhealthbag.com/sitemap/">Sitemap</a>';
    $newline_credits = '<em>* These statements have not been evaluated by the Food and Drug Administration. The material on this site is provided for informational purposes only and not medical advice. Always consult your physician before beginning any diet or exercise program.</em>';
    return '
    <div class="span4 credits">
                        <p> &middot; &copy; '.esc_attr( date( 'Y' ) ).' '.esc_attr(get_bloginfo()).' &middot; '.($credits ? $credits : 'Designed by <a href="https://www.themesandco.com/">Themes & Co</a>').' &middot;'.($newline_credits ? '<br />&middot; '.$newline_credits.' &middot;' : '').'</p>        </div>';
    }
    
    //remove comments html tags
    add_filter('comment_form_defaults' , 'remove_allowed_html_tags_note', 30);
    function remove_allowed_html_tags_note( $defaults ) {
        //returns the modified array
        return array_replace( $defaults, array('comment_notes_after' => '' ) );
    }
    //place yellowbox on pages using shortcode
    function make_yellowbox($atts, $content = null) {
       return '<p style="background: none repeat scroll 0 0 #ff9; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #e5e597; padding: 13px;">' . do_shortcode($content) . '</p>';
    }
    add_shortcode('yellowbox', 'make_yellowbox');
    
    // Adds a widget area.
    if (function_exists('register_sidebar')) {
     register_sidebar(array(
     'name' => 'Extra Header Widget Area',
     'id' => 'extra-widget-area',
     'description' => 'Extra widget area after the header',
     'before_widget' => '<div class="widget my-extra-widget">',
     'after_widget' => '</div>',
     'before_title' => '<h2>',
     'after_title' => '</h2>'
     ));
    }
    // Place the widget area after the header
    add_action ('__after_header', 'add_my_widget_area', 10);
    function add_my_widget_area() {
     if (function_exists('dynamic_sidebar')) {
     dynamic_sidebar('Extra Header Widget Area');
     }
    }

    Also, Dont forget the theme width, if there is a way i can make it look exactly the way it looks in my natural health blog without using the left side bar

    Plenty thanks

    Your functions.php is fine.
    Could it be a plug-in issue. Without removing the “issue” we cannot achieve the result you want, we can go close, but not exactly what you want, ’cause “Page: 1” at this moment is one “block” so we can style “2” and “Page: 1” but not “Page:” “1” and “2” singularly.

    About the width, if you want to set an offset for layouts with right sidebar without setting a left sidebar then:
    1) Change the layout from full to right
    2) Add this to your child-theme functions.php

    add_filter('tc_global_layout', 'my_custom_rs_layout' );
    function my_custom_rs_layout( $layout ) {
        $layout['r']['content'] = 'span6 offset3';
        $layout['r']['sidebar'] = 'offset3';
    
        return $layout;
    }

    Is this what your wanted?

    Thread Starter ifelarry

    (@ifelarry)

    YES! Thanks man… You are a problem solver.
    The code worked like magic. I’ve been able to adjust it a bit changing the offset and the span to something better than what i wanted initially.

    Talking about the pagination thingy, I have tried to disable all my plugins but no difference. Do you think i should delete and re-download the theme?

    How ever, Its not compulsory the pagination “nextpage or page2” looks exactly like what i want. I just want something far better than what i have at present so that people will know they should click for the next page.

    Furthermore, is it possible to move the page numbers up to immediately after the post because they show up after my related content and sharing buttons if it is activated. this is an example

    Please pardon my plenty issues.

    Well the thing is that plugins you’re using to display related content put their “code/text” just after the content, so basically, the better thing to do is to not use their automatic placement and use their functions to hook where we want.
    Anyway sorry, about pagination, it’s the default one for posts. My fault.
    I will back with some code in the next hours (but maybe tomorrow), can you wait?

    Thread Starter ifelarry

    (@ifelarry)

    Thanks for your help. I’m really grateful.
    I’ll be patiently waiting till you are back.

    Hi ifelarry. Add this to your child-theme functions.php:

    add_filter( 'wp_link_pages_link', 'wrap_current', 10, 2 );
    function wrap_current( $elem, $i ) {
        if ( $i != 1 )
            return $elem;
        return '<span class="current">' . $elem . '</span>';
    }
    $my_args = array();
    /* replace args */
    add_filter( 'wp_link_pages_args', 'my_link_pages_args');
    function my_link_pages_args( $wplp_args ){
        global $my_args;
        $pars = array(
            'before' => '',
            'after'  => '',
            'link_before' => '<button class="btn btn-small">',
            'link_after' => '</button>',
            'separator'  => ' ',
            'nextpagelink' => __('Next Page &raquo;'),
            'previouspagelink' => __('&laquo; Previous Page')
        );
        $my_args = array_merge($wplp_args, $pars);
        return $my_args;
    }
    /*wrap the paginator*/
    add_filter( 'wp_link_pages', 'wrap_paginator' );
    function wrap_paginator( $paginator ){
        global $page, $numpages, $my_args;
        $div_start = '<div class="my-paginator">';
        $div_end = '</div>';
        $prev = '';
        $next = '';
        if ( $page - 1 )
            $prev = str_replace('href', 'class="prev" href', _wp_link_page( $page - 1 ) )
            . $my_args['link_before'] . $my_args['previouspagelink'] . $my_args['link_after'] . '</a>';
        if ( $numpages > $page )
            $next = ' '. str_replace('href', 'class="next" href',_wp_link_page( $page + 1 ) )
            . $my_args['link_before'] . $my_args['nextpagelink'] . $my_args['link_after'] . '</a>';
    
        return $div_start.$prev.$paginator.$next.$div_end;
    }

    Then you can style it the way you want (in your child-theme style.css or your custom css), starting by this, e.g., for the current page:

    .my-paginator .current button {
        cursor: initial;
        outline: #60e1c2 auto 5px;
        outline-offset: -2px;
        background-position: 0 -15px;
        background-color: #e6e6e6;
    }

    Hope this helps.

    Thread Starter ifelarry

    (@ifelarry)

    WOW!!!!!!!!!!!….
    d4z_c0nf the problem solver has perfectly resolved my issue.
    Mehn…. you are good. Thanks a bunch.

    You’re welcome ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Pagination Problem’ is closed to new replies.