473,602 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wordpress » Page shows Categories, pages

gcoaster
117 New Member
Hello All..

I need help with wordpress,
I have figured out how to show certian posts with category in a page..
but the page numbers are not working and i cant figure out why.

Here is the code to query and show categories in california

Expand|Select|Wrap|Line Numbers
  1. <?php query_posts('category_name=california'); ?>
  2. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  3.  
for some reason the page numbers at the bottom are not working.. does anyone know what code i need to add?

here is the page code, next and prev

Expand|Select|Wrap|Line Numbers
  1. <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  

thank you!
Jul 13 '09 #1
5 3450
dlite922
1,584 Recognized Expert Top Contributor
Most likely you changed one variable somewhere to increase the num per page (probably hard coded it) and forgot to change it else where (where it still expects a variable, that may now be undefined for example).

I don't know the WordPress code by memory to help you locate it.

My advice: What code you posted is barely enough to cover your question. Try to understand what the code does, trace it, and find the problem.

Good luck,



Dan
Jul 13 '09 #2
gcoaster
117 New Member
Hello Dan!

here is the full code..

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /*
  3. Template Name: page_states
  4. */
  5. ?>
  6.  
  7. <?php get_header(); ?>
  8.  
  9. <div id="main">
  10.  
  11. <div id="contentwrapper">
  12.  
  13. <?php
  14. global $more;
  15. $more = 0;
  16. ?>
  17.  
  18. <?php query_posts('category_name=california'); ?>
  19. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  20.  
  21.  
  22. <div class="topPost">
  23. <?php edit_post_link('Edit', ' | ', ''); ?></span></p>
  24. <h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  25.   <p class="topMeta">Location » <?php the_category(', '); ?>
  26.   <div class="topContent"><?php the_content('(More Info...)'); ?></div>
  27.  
  28. <div class="cleared"></div>
  29. </div> <!-- Closes topPost --><br/>
  30.  
  31.  
  32. <?php endwhile; ?>
  33. <?php endif; ?>
  34.  
  35.  
  36. <div class="navigation">
  37. <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  
  38. </div><!-- Closes navigation-->
  39.  
  40.  
  41. <div class="cleared"></div>
  42.  
  43. </div> <!-- Closes contentwrapper-->
  44.  
  45. <?php get_sidebar(); ?>
  46.  
  47. <div class="cleared"></div>
  48. </div><!-- Closes Main -->
  49.  
  50. <div class="cleared"></div>
  51. <?php get_footer(); ?>
  52.  
Jul 13 '09 #3
dlite922
1,584 Recognized Expert Top Contributor
No, I don't think you know how programming works. This is not the full code.

The full code is multiple files probably, and I can't go through it for you to find your problem. (Unless you pay me ;) )

My original point was for you to "Try to understand what the code does, trace it, and find the problem " yourself.

If you don't know how a particular thing works, you have the manual at php.net to look up particular php function or otherwise ask us what a piece of code does, not the entire program.

WordPress is an open source app. I'm sure they have help forums where you can get help. Those guys probably will know the entire code more than us.

Good luck,




Dan
Jul 14 '09 #4
pdkadam
6 New Member
Its practically impossible to trace the error in a small code snippet that actually has roots & branches in multiple files.
My advice is refer this for wordpress problems:
http://codex.wordpress.org/Main_Page
and search for the exact solution.
Sorry couldnt help much about it.
Jul 15 '09 #5
gcoaster
117 New Member
Hello All!!

FOUND IT!!!

Here is the solution for Pagenation in Wordpress using a page template querying one category.!!! Enjoy! this was a HARD Find... Hope it helps someone

<?php if(have_posts() ) : ?>
<?php $paged = (get_query_var( 'paged')) ? get_query_var(' paged') : 1;
query_posts("ca tegory_name=Cat egoryName&paged =$paged"); ?>
<?php while(have_post s()) : the_post(); ?>


In Christ,
Matt
Jul 15 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

14
3700
by: Michele Ferretti | last post by:
http://www.blackbirdblog.it/programmazione/progetti/28 -- Michele Ferretti ICQ#: 14491159 Skype: m.ferretti79 black DOT bird AT tiscali DOT it www.blackbirdblog.it
0
4101
by: surfivor | last post by:
I am doing some preliminary research as we are slated to do a project with wordpress. I looked at the wordpress code and realized why I like MVC so much (Rails) because the code mixed in with the rendering looked like a mess to me. I'm not at all sure exactly what we will be doing on the project as the details haven''t been discussed yet. I found that the Wordpress API doesn't look well documented. I set up wordress and created some blog...
0
1331
by: Ken | last post by:
Hi. I've recently organized and even color-coded many of my favorite bookmarks on WEB DEVELOPMENT (and a few other favorite subjects too) into what I call QUICK LINK PAGES. These are very condensed, compact (no graphics), fast-loading pages with a 100+ links to some of my favorite web sites on a particular subject. I hope you'll give them a try... Here's the link... http://www.winograd.com/QLP
2
1426
nomad
by: nomad | last post by:
An employee that was working on the project left, I got the task to rework some blog pages in WordPress. I have some exp. working with WordPress and PHP. but I hve no ideal how to do the following: I do... I place a blog in an exist blog page. ie this blog page is simular to an HTML page but has NO place where people can write their thoughts about it. An example would be nice, or if you can give me a link where I can do this that would be...
9
3099
by: Nooze Goy | last post by:
I'm trying to use a blog client to write messages with "attached" .pdf content to WordPress blogs. WIth the "Direct Upload" mechanism, the attached files work for some types (like .txt) but fails with .pdfs, with a message about an XML parsing error. However, the XML code looks pretty good to my untrained eye, and gives no errors when run through some verifiers , and there are no errors in the httpd logs. As far as I can tell, this is...
1
3737
by: Spondishy | last post by:
Hi, I've been digging around the web but haven't found a really good example of how to create a new post in a wordpress blog. I've found metaWeblog.newPost discussed in a few places, but I'd like more info (or a working example if possible). Especially with posting into specific categories. Thanks in advance.
21
7680
by: karen987 | last post by:
I have a news website, with asp pages. It has publishing software which allows you to add articles in a database, and then calls them up from links etc. I have added dynamic meta tags in 2 parts. The first part is in the inc.header.asp file which is called up on every page. The page itself has the meta tag variable, ie. title, description. They work fine on all pages, except the one below i'm having problems with. Ironically it's the most...
7
2697
by: maya | last post by:
hi expert php'ers.....;) is it ok to ask WordPress questions here? I mean if you don't get a response to your quetion in WP forums where else can you go?? I have WP 2.3 installed on my own hosting server.. I'm tying to do something that should be quite simple yet I can't get it to work... I want to do my own form, w/o having to use a plugin.. I tried a contact plugin, but you can't specify what address to send email to, which
4
3759
by: sleepy1038 | last post by:
Hello, I'm developing a site that makes use of wordpress. The homepage is outside of wordpress and I am pulling the latest 3 blog posts from the wordpress database to display on the homepage. The problem is that special characters (&mdash;) for example, do not display properly. It displays as a "?" with a diamond around it �. The characters actually display fine withing the wordpress blog portion of the site. I tried changing the...
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.