Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #50804

    Harry B
    Participant

    I would like to know if it is possible to sort posts by “Title” instead of by date. I understand “date” is the WordPress default, however i have used other themes where you can choose how to sort. Am I overlooking this ability somewhere in Customizer? I read the WordPress Codex and it shows you can change this in the “Category.php” file, however I can’t seem to find this file either. Please advise. I am creating a site for a town of approximately 100,000 people and I need to alphabetize the points of interest. I will eventually have over 1000 listings and I certainly do not want to have to change dates to achieve this. Thanks for your help. I have included the codex script as follows.

    <?php
    get_header();
    ?>

    <div id=”content”>

      <?php
      // we add this, to show all posts in our
      // Glossary sorted alphabetically
      if (is_category(‘Glossary’))
      {
      $args = array( ‘posts_per_page’ => -1, ‘orderby’=> ‘title’, ‘order’ => ‘ASC’ );
      $glossaryposts = get_posts( $args );
      }
      foreach( $glossaryposts as $post ) : setup_postdata($post);
      ?>

    • “><?php the_title(); ?>
    • <?php endforeach; ?>

    —————————-
    I am using Integrity. I love the theme by the way.

    Harry

    #51070

    Rad
    Moderator

    Hi Harry,

    Thank you for writing in!

    Add this code at your child theme’s functions.php

    add_action('pre_get_posts', 'category_sort_by_title');
    function category_sort_by_title($query)
    {
        if (is_category()) {
            $query->set('orderby', 'title');
            $query->set('order', 'ASC');
        }
    }

    Hope this helps.

    #51579

    Harry B
    Participant

    Thanks for the reply. I will try this tomorrow!

    #51900

    Harry B
    Participant

    Unfortunately this script did not work! I placed it in the child theme “functions.php” as prescribed to no avail. I can’t express how important the ability to sort posts by title is for this large of a community’s site. Visitors will be searching for “Businesses”, “Restaurants”, “Shops”, “Parks”, etc. from hundreds of listings in each category. I know I can manipulate entry dates so that it works, however this will be too constraining considering I will be constantly adding, and deleting new listings as they open and close. Please advise. Thanks for your help.

    Harry

    #52357

    Support
    Member

    Hey Harry,

    Looks like I will need to get some information from you (don’t forget to select Set as private reply to ensure that your data remains hidden):

    1. Your WordPress login credentials.
    2. Your FTP credentials (in case we need to check anything out on your server).

    Once we have all of this, we’ll be happy to take a deeper look into things.
    Thanks!

    #52536

    Harry B
    Participant
    This reply has been marked as private.
    #52864

    Support
    Member

    Hey Harry,

    I’ve just checked your site, and it seems the script is working here: http://www.thewoodlandsquarterly.com/category/attractions/

    Please advise!

    #53081

    Harry B
    Participant

    That category is sorted just by coincidence of the posts being entered by date. My “blog page” is http://www.thewoodlandsquarterly.com/guide-listings/ – they are not sorted here. I tried changing the page so that it was not masonry, and they are still out of order.

    Harry

    #53223

    Support
    Member

    Hey Harry,

    We originally thought you only want to sort this while on the category archive page, in which our code will never work. But with just a slight change on our code, this will fix your issue.

    Replace the code above with this, this should affect all post listings:

    add_action('pre_get_posts', 'category_sort_by_title');
    function category_sort_by_title($query) {
      $query->set('orderby', 'title');
      $query->set('order', 'ASC');
    }

    Cheers

    #60211

    Harry B
    Participant

    I am sorry to submit a new request via this thread, however the home page of your “support section” is currently broken, and I can not find the link for submitting a new request.

    I would like to know how to display “full-content”, “excerpts”, and “tags” on the portfolio index pages and archived category pages.

    I am building a site for a master-planned community in Texas that has approximately 131 parks with different amenities that I would like to filter using your isotope feature. Since your blog does not offer isotope filtering like your portfolio, I have decided to enter each park as a portfolio item. Each Park – has a combination of swimming pool, dog area, tennis court, basketball court, disc golf, bmx track, jogging track, climbing boulders, soccer fields, spraygrounds, etc. With this many parks residents would like to know which park offers what amenities. Each of these 131 parks is also located in one of ten different “villages” that I plan to use as tags for further sorting. Ideally I would love to have the archived portfolio posts look exactly the same as the archived blog posts (displaying all content and tags below the box) with the ability to filter using the same isotope animation as is offered in your portfolio layouts. If it is easier to offer isotope filtering for the blog that is fine too.

    My website is http://www.thewoodlandsquarterly.com – The parks page is under “guide” – submenu – “parks and recreation”. I have already set up a child theme and currently have the functions.php and content-portfolio.php copied to it.

    Thanks so much for your help.

    Harry

    #60712

    Rad
    Moderator

    Hi Harry,

    Sure, just follow this.

    1. Create a file and name it content-portfolio.php under /x-child-integrity-light/framework/views/integrity/

    2. Edit that file and paste this and replacing any code inside.

    <?php
    
    // =============================================================================
    // VIEWS/INTEGRITY/CONTENT-PORTFOLIO.PHP
    // -----------------------------------------------------------------------------
    // Portfolio post output for Integrity.
    // =============================================================================
    
    $archive_share = get_theme_mod( 'x_integrity_portfolio_archive_post_sharing_enable' );
    
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <div class="entry-featured">
        <?php x_portfolio_item_featured_content(); ?>
      </div>
      <div class="entry-wrap cf">
    
            <header class="entry-header">
              <h1 class="entry-title entry-title-portfolio"><?php the_title(); ?></h1>
              <?php x_integrity_entry_meta(); ?>
            </header>
            <?php x_get_view( 'global', '_content', 'the-content' ); ?>
    
            <?php x_portfolio_item_tags(); ?>
            <?php x_portfolio_item_project_link(); ?>
            <?php x_portfolio_item_social(); ?>
    
      </div>
      <?php x_google_authorship_meta(); ?>
    </article>

    Cheers!

    #64283

    Harry B
    Participant

    I am sorry I am just now responding to this. I have been out of the country for the past week. I am not sure I understand your directives. I have copied the original content-portfolio.php file and pasted it in the “/x-child-integrity-light/framework/views/integrity/” directory. Where am I supposed to paste your code? – Your directive states to “create a new content-portfolio.php” and ” Edit that file and paste this and replacing any code inside. If I am creating a new content-portfolio.php file there will not be any code in it to edit or replace. This directive seems a little ambiguous. I am sorry, I am not familiar with working with php so this may be the problem. I understand editing CSS in the stylesheet, and that is about the extent of my coding knowledge. Thanks for your help. If I am supposed to paste the code you so kindly provided into the original content-portfolio.php where would I put it. I do understand php requires the following.

    <?php ?>

    however you included some code outside of this that begins and ends with the <article tag – which I am clueless on. I am sorry, but I very interested in learning how and why you do this.

    Cheers,

    Harry

    #64693

    Mrinal
    Member

    Hey Harry,

    I’m really sorry for the confusion, please follow the step one by one:

    1) please go wp-content/themes/x/framework/views/integrity/ find content-portfolio.php.
    2) Now, copy this file & paste into wp-content/themes/x-child-integrity-light/framework/views/integrity/
    3) Now open the file from Child theme using a Text Editor, replace all of the codes of it with the codes given by us in previous reply.

    Hope this helps, Cheers!

    #64747

    Harry B
    Participant

    Thanks for the help, however this code is locking my portfolio layout page(http://www.thewoodlandsquarterly.com/parks-2/), and I can not display any portfolio items either. I followed the steps as requested. The only thing I did differently was that I edited the content-portfolio.php file directly on my server (bluehost.com) and saved the changes there. The content-portfolio.php file was copied to the child directory as directed, all content was deleted, and the new code you sent was pasted as is – no modifications. I am repasting the code here so you can recheck to make sure some “tag” is not missing.

    —————————————————–

    <?php

    // =============================================================================
    // VIEWS/INTEGRITY/CONTENT-PORTFOLIO.PHP
    // —————————————————————————–
    // Portfolio post output for Integrity.
    // =============================================================================

    $archive_share = get_theme_mod( ‘x_integrity_portfolio_archive_post_sharing_enable’ );

    ?>

    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    <div class=”entry-featured”>
    <?php x_portfolio_item_featured_content(); ?>
    </div>
    <div class=”entry-wrap cf”>

    <header class=”entry-header”>
    <h1 class=”entry-title entry-title-portfolio”><?php the_title(); ?></h1>
    <?php x_integrity_entry_meta(); ?>
    </header>
    <?php x_get_view( ‘global’, ‘_content’, ‘the-content’ ); ?>

    <?php x_portfolio_item_tags(); ?>
    <?php x_portfolio_item_project_link(); ?>
    <?php x_portfolio_item_social(); ?>

    </div>

    —————————————————–

    Before I made the directed changes – the “parks” portfolio layout page would display all titles of parks and filter them correctly. The only problem was that only the titles would show. No content. Now nothing shows, nor can I even display any of the portfolio items individually. Thanks for your help.

    Harry

    #65107

    Rad
    Moderator

    Hi Harry,

    The fix will only work with latest X theme (2.0+), currently you’re still using old X version. Also, not sure why but your plugin version are little different which I guess due to customization? For example js-comp-ver-4.1.3.1, please update your x theme and all of your X plugin copies.

    Let us know how it goes.