Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1035857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:36:35+00:00 2026-05-16T14:36:35+00:00

This is the page, its a wordpress powered site: http://bit.ly/9oJXWV You select some value,

  • 0

This is the page, its a wordpress powered site:

http://bit.ly/9oJXWV

You select some value, it makes POST to same page and based on value you selected it makes a list pages.

Now before you jump into my code i just want to say that im a newbie and that my main problem here were database queries so i didnt focus on other small stuff(like bunch if’s at start inline css and stuff like that).

So this is my template:

http://pastebin.com/HQvMq3Db

This is a function from functions.php which im using in template:

http://pastebin.com/fWKqqzQv

This page works the way i want it and i just finnished putting all the code together but have one issue. Once i get that sorted out i will make the code a lot nicer… 🙂

So the issue is that if you look at pages that are listed once you make a selection and submit, on a lot of them some values are missing even thought those values are there(open any page from that list which is missing some value and you can pretty much see the same stuff but now it display’s all the data).

So that is the part i need help with debugging. I really have no idea how to tackle this.

Second part of this question is simple: how do i paginate this page? Any link, tip, tutorial would be good.

Also one more thing, how can i have links for example like this:

…/hostels/?grad=Beograd

and when user opens up that page he does not have to click to select the town, it would already list all pages from “Beograd”? I guess that is GET request right? Can i do something like that with POST? O_o Not sure what to do here, like i said im newbie.

Thanks for reading, looking forward to answers and comments.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:36:35+00:00Added an answer on May 16, 2026 at 2:36 pm

    1) I fixed pagination simply by implementing &paged='.get_query_var('paged') to my query. Now it looks like this:

    $hostels = new WP_Query('post_type=page&meta_key=Grad&meta_value='.$grad.'&posts_per_page=60&orderby=title&order=ASC&paged='.get_query_var('paged'));
    

    @js1568 i gave him +1 for his answer, but he didnt answer my entire question.

    Now i can go through pages like so:

    /acommodation/hostels/?city=beograd - this is page 1
    /acommodation/hostels/page/2/?city=beograd - this is page 2
    /acommodation/hostels/page/3/?city=beograd - this is page 3
    etc...
    

    2) The issue with missing info from some pages is fixed by putting this below the end of inner loop:

    wp_reset_query();
    

    and also i created some custom function which will get all meta values for given post id:

    function custom_get_meta_values($id){
    
    $first_array = get_post_custom_keys($id);
    
    foreach ($first_array as $key => $value) :
           $second_array[$value] =  get_post_meta($id, $value, FALSE);
            foreach($second_array as $second_key => $second_value) :
                $result[$second_key] = $second_value[0];
            endforeach;
     endforeach;
    
    return $result;
    }
    

    In my inner loop i call that function like this:

    $result = custom_get_meta_values($post->ID);
    

    Then i just echo what i need like so:

    echo $result['Mail'];
    

    Just put the name of meta field in that $result array and echo it.

    3) I replaced POST with GET request so now i can have links like this:

    /acommodation/hostels/?city=beograd
    

    which when opened will show every hostel from ‘beograd’. I only have 4 possible values for cities so if value of ‘city’ that i capture from GET request is not one of those 4 values, i do nothing, just show that form. If it is i take that value and show the list from that city.

    As per Will instructions, i will mark this answer as accepted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login.jsp page which contains a login form. Once logged in the
This is beyond both making sense and my control. That being said here is
I have found this example on StackOverflow: var people = new List<Person> { new
I want to use a temp directory that will be unique to this build.
I have a new web app that is packaged as a WAR as part
(please excuse that I didn't use aliases). I would like my query output to
I'm trying to build a C++ extension for python using swig. I've followed the
Let say I have the following desire, to simplify the IConvertible's to allow me
I need to develop a file indexing application in python and wanted to know
I was reading JavaScript: The Good Parts and the author mentions that JavaScript is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.