Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author myCred

    (@designbymerovingi)

    Hi.

    Have you tried to flush your permalinks?
    If that does not help, check that you followed the update guide.

    Thread Starter Nadeem Khan

    (@chillopedia)

    I have followed the update doc and also tried after resaving the permalinks but I still get a 404. Below is the code of my archive-mycred_rank.php that generates the ranks related output:

    <?php if (have_posts()) : ?>
        <div id="rank-<?php the_ID(); ?>" <?php post_class(); ?>>
            <table>
                <?php
                $my_query = new WP_Query('post_type=mycred_rank&posts_per_page=13&order=DESC');
                $index = 0;
                while ($my_query->have_posts()) : $my_query->the_post();
                    $users_with_current_rank = mycred_get_users_of_rank(get_the_ID());
                    $rank_results_count = count($users_with_current_rank);
                    $total_users = count_users();
                    $percentile = ($rank_results_count / $total_users['total_users']) * 100;
                    $rank_title = get_the_title();
                    ?>
                    <tr class="rank-table-row">
                        <td ><h3 class="entry-title rank-title"><a href="<?php echo home_url() . '/rank/' . strtolower($rank_title); ?>" target="_blank"><?php echo $rank_title; ?></a></h3></td>
                        <td ><?php echo $criteria[$index]; ?></td>
                        <td ><?php echo $rank_results_count; ?></td>
                        <td ><?php echo (number_format((float) $percentile, 2, '.', '')); ?></td>
                    </tr>
            </div>
            <?php
            $index++;
        endwhile;
        wp_reset_query();
        ?>
        </table>
    <?php else : ?>
        <h2 class="center">Not Found</h2>
        <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    <?php endif; ?>
    Plugin Author myCred

    (@designbymerovingi)

    On the myCRED > Settings page under “Ranks” did you set ranks to be “Public”? What did you enter in the URL field further down?

    Thread Starter Nadeem Khan

    (@chillopedia)

    Yes, ranks are public and I have entered rank in the url field.

    Here is the link to the screenshot of my settings:

    View post on imgur.com

    Plugin Author myCred

    (@designbymerovingi)

    I would check if the url is the issue by changing it to something else temporarily, save, then flush my rewrite rules and see if that works. 404 is an issue related to URLs, if you had an issue in your template then the page would load but with errors / blank screen.

    Thread Starter Nadeem Khan

    (@chillopedia)

    Sorry, it isn’t a 404 with https://example.com/rank but it appears the <?php if (have_posts()) : ?> statement fails and the <?php else : ?> statement is executed.

    Regarding changing the url field, when I changed the url in the field to ‘ranks’ and visited “https://example.com/ranks/&#8221; after saving the permalinks again in Settings->Permalinks, same else statement is executed in the template.

    Plugin Author myCred

    (@designbymerovingi)

    Do you use multiple point types? Do you have ranks setup for more then one type?

    Thread Starter Nadeem Khan

    (@chillopedia)

    The plugin was working perfectly fine and it was indeed a template related issue as I was checking:

    <?php if (have_posts()) : ?>

    before

    <?php $my_query = new WP_Query('post_type=mycred_rank&posts_per_page=13&order=DESC');
    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    which is wrong as there aren’t any posts for this page before WP_Query is called. The correct statement is:

    <?php if ($my_query->have_posts()) { ?>

    and it should be called after the $my_query.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Rank archive page is not working after updating to 1.6.1’ is closed to new replies.