Your address will show here +12 34 56 78

Home Forums WP RESIDENCE – Real Estate WordPress Theme FORUM Agents in Alphabetical Order

This topic contains 7 replies, has 3 voices, and was last updated by  bruce1 2 years, 11 months ago.

  • Author
    Posts
  • #100466

    m1playas15
    Participant

    Hello, how can I make my agents appear on Alphabetical Order ??

    THanks

    ——–

    Answer:

    in agent-list.php

    add in here
    $args = array(
    ‘post_type’ => ‘estate_agent’,
    ‘paged’ => $paged,
    ‘posts_per_page’ => 10);

    this

    ‘orderby’ => ‘title’,
    ‘order’ => ‘DESC’  sau ASC

    You should write the PHP code yourself as you’re copying wrong formatting.

    I made a screenshot of how the code should look in agents_php for ASC order by title

    order by alphabet agents

    • This topic was modified 2 years, 11 months ago by  Anna.
    • This topic was modified 2 years, 11 months ago by  Anna.
    • This topic was modified 2 years, 11 months ago by  Anna.
  • #100477

    Anna
    Keymaster

    Hi,

    Please see this forum for instructions: http://wpestate.org/forums/topic/order-agents-alphabetically-in-agent-list/

    Thank you,
    Anna

  • #100492

    m1playas15
    Participant

    I placed the code, but my agents are not showing up fully in order.

  • #100618

    Anna
    Keymaster

    Hi m1playas15,

    If the query you changed is not applying, you may need to review the code or to update the query. At this point I can only recommend to review the code or to go to WordPress for further modifications http://codex.wordpress.org/Class_Reference/WP_Query (look for orderby).

    Thank you,
    Anna

  • #100662

    bruce1
    Participant

    Hi Anna, to be clear did you mean to copy in agents-list.php I do no see agent-list.php

    When I do I get error
    Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/nhrealty/public_html/wp-content/themes/wpresidence/agents_list.php on line 32

  • #100663

    bruce1
    Participant

    This is how it looks in file now

    <div id=”listing_ajax_container_agent”>
    <?php
    $args = array(
    ‘post_type’ => ‘estate_agent’,
    ‘paged’ => $paged,
    ‘posts_per_page’ => 10 );
    ‘orderby’ => ‘title’,
    ‘order’ => ‘DESC’ sau ASC

    $agent_selection = new WP_Query($args);
    while ($agent_selection->have_posts()): $agent_selection->the_post();
    print ‘<div class=”col-md-‘.$col_class.’ listing_wrapper”>’;
    get_template_part(‘templates/agent_unit’);
    print ‘</div>’;
    endwhile;

  • #100664

    Anna
    Keymaster

    Hi Bruce

    You should not copy paste 🙂

    You should write the PHP code yourself as you’re copying wrong formatting.

    I made a screenshot of how the code should look in agents_php for ASC order by title

    Thank you
    Anna

    order by alphabet agents

    • This reply was modified 2 years, 11 months ago by  Anna.
    • This reply was modified 2 years, 11 months ago by  Anna.
  • #100670

    bruce1
    Participant

    Much better, thanks Anna

You must be logged in to reply to this topic.