Community Forums › Forums › Archived Forums › General Discussion › pagination busted for category listing
Tagged: categories, pagination
- This topic has 14 replies, 3 voices, and was last updated 9 years, 10 months ago by bionary.
-
AuthorPosts
-
June 17, 2014 at 5:46 pm #110294bionaryMember
I have a page that lists posts from only the category: Video. All of the posts are there on the backend and the pagination seems allotted correctly but each page is simply the same list of videos as page 1. So no matter which page (pagination numbers) one clicks on they get the last 7 posts.
It does work correctly when navigating via Category (as in clicking the category on the sidebar)
I'm using a custom template for my video page like this:
http://helloartsy.com/video-tutorialsadd_action( 'genesis_before_content', 'displayVideoPosts' ); function displayVideoPosts() { query_posts('category_name=videos&showposts=7'); } //* This file handles pages, but only exists for the sake of child theme forward compatibility. genesis();
June 17, 2014 at 5:56 pm #110295Brad DaltonParticipantNever use query_posts http://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts
It also uses the old XHTML loop hooks. http://my.studiopress.com/docs/genesis-loop-hooks-comparison/
June 17, 2014 at 7:19 pm #110301bionaryMemberso now I'm using the following in my videos template with no success:
function display_videos( $query ) { if ( $query->is_main_query() ) { $query->set( 'cat', 'videos' ); } } add_action( 'genesis_entry_content', 'display_videos' );
I even get a fatal error "Fatal error: Call to a member function is_main_query() on a non-object in..."
I also tried using pre_get_posts and WP_Posts object but can't get it to work.
What am I missing?June 17, 2014 at 7:48 pm #110310Brad DaltonParticipantJune 17, 2014 at 7:52 pm #110313bionaryMemberhttp://helloartsy.com/video-tutorials/
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ //* Template Name: Videos function display_videos( $query ) { if ( $query->is_main_query() ) { $query->set( 'cat', 'videos' ); } } add_action( 'genesis_entry_content', 'display_videos' ); //* This file handles pages, but only exists for the sake of child theme forward compatibility. genesis();
June 19, 2014 at 1:22 am #110520SummerMemberThere's a way to use the arguments in calling
genesis_custom_loop();
instead ofgenesis_loop();
but I can't seem to find the exact snippet at the moment... the gist is you would call the custom loop with your defined arguments before you made thegenesis();
call.You would pass it arguments the same way you would in WP_Query, here are the args for pagination:
http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_ParametersOne question, how would the Video Tutorials page be different from the category archives of Videos? Unless I'm missing something, it seems you're duplicating your content.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJune 19, 2014 at 6:04 am #110540bionaryMemberOne question, how would the Video Tutorials page be different from the category archives of Videos? Unless I’m missing something, it seems you’re duplicating your content.
They are essentially the same. It's a UX thang. I want users to be able to have a convienient list of video tutorials as a page with a simple url... without having to click on a category link and I don't want the extra slugs in the url otherwise I realize I could just link to the categories/videos url.
June 19, 2014 at 8:24 am #110562SummerMemberI don't understand the "simple url" requirement you're talking about... the extra words in the URL don't matter.
Also, Google could ding you for duplicate content, if you're not careful, because your videos page and your category archives for videos would be the same... just be aware of that. Google cares about the content and the titles, not how you get there.
For instance, these pages on some of my sites have not mattered a whit that they have the word "category" in them:
http://www.zombiechannel.com/category/zombie-videos/ (hmmm, looks like some of them have gone missing again)
http://www.sliceofscifi.tv/category/its-comic-book-day/
And the links for both of those are in the main nav menus, no problem. In the choice between using vanity URLs and avoiding the wrath of Google, I'll choose avoiding the wrath of Google for $200 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJune 19, 2014 at 8:39 am #110567bionaryMember@summer
But I thought I wouldn't be penalized for duplicate content because genesis applies a no-index meta tag to categories. That was in fact an important selling feature to me when deciding to go the word press route. I'm definitely no seo expert, not yet anyhow. Thinking about it, I just get annoyed by long buried urls I suppose especially when they have lots of "/" s
June 19, 2014 at 9:56 am #110578SummerMemberI still get headaches trying to remember all the ever-changing SEO "rules of thumb". I have two legit sites that were obliterated by Penguin or Panda or both since 2010, and apparently there's nothing I could do except fix and wait, fix and wait, and thank Google for nuking 6 years of hard work.
You know what's truly funny about not wanting to see the long URLs? I discovered last year that a lot of people don't even have the address bar turned on on their browsers, so they never even see the URL they're going to.
They literally don't know how to surf the web without starting at a search engine, and when you say things like "type this into your address bar" they have no idea what I'm talking about. I spent 10 minutes trying to get a client to take a look at a dev site that I was building for her, not realizing that she was typing the name into Google and not getting any results and getting mad at me for the site not being able to be found.
I had to walk her through adding the address bar to her browser and teach her how to type in a URL. It was too confusing for her... and all the while I was wondering if an icepick in my left eye would hurt less.
And no, she wasn't the only person I've had to do that with.
So as long as Google can index your URL, the chance that most of your visitors will ever care that the word "category" appears in it are about 200 million to 1 against.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJune 19, 2014 at 11:57 am #110590bionaryMember@summer ... point take and ice pick = yes. My wife, mother and many work colleagues still don't understand address bar vs. search bar; even though I have politely explained and demonstrated 100+ times.
Now I am right on the edge of being convinced however I have one *slight caveat. The category is called "Videos" and the page/page link is called "Video-Tutorials". I know google can penalize for link text not matching link pointer (href). I know I'm being a super seo-pain-in-the-@$$ but that again is one of the reasons I went with word press and a premium template. I could have rattled off a custom site in a fraction of the time I've spent learning and hacking away at wp.
June 19, 2014 at 5:33 pm #110681SummerMemberI've never heard any such thing about the title needing to match the URL.
There are plenty of high level bloggers who use post slugs (permalinks) that don't match the title of the articles, simply because of the length of the title. Take a look at the permalinks and titles at Copyblogger if you don't believe me 🙂
For example:
Title: Do You Have What It Takes to Be a Writer? Answer This Question to Find Out …
URL: http://www.copyblogger.com/the-hedgehog-concept/and take a look at the blogs at Moz.com (SEO Central, in some folks' books).
That URL matching the title thing is definitely not something those folks are following.
And learning WordPress isn't a bad thing... sometimes it's good to have a tool do all the heavy lifting for you so you can concentrate on the presentation and the content.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJune 19, 2014 at 7:02 pm #110698bionaryMember@summer
No not the title, the "href" and the link text. I have heard bloggers talking about how google frowns upon mismatches such as click here for this only cause it can be misleading to users and google's algorithms are trying to be as humanly possible. So in my instance I'll be doing something like Video Tutorials I'm probably being too knit picky I know 🙂
June 19, 2014 at 7:12 pm #110699SummerMemberThey are talking about links in the content, and since I think Google was doing that to push back on folks embedding questionable backlinks to external sites to game the link juice, you should be good. My personal rule of thumb is to always use the page title I'm linking to, if it's an internal link to another page on the same site.
It's the same as having "Video Tutorials" in your nav menu, but the link would say "/category/videos/" ... not something Google would penalize you for.
And regarding the backlinks thing, never waste your time with people who want to buy backlinks on your older content. Google is starting to heavily penalize those, as well as going after some of the larger solicitors of such links. A couple of my sites have been running WordPress for 9 years now, and the number of newbie seo scammers who say "hey I've got this great link that I'd like you to embed in an article from 2006 and we'll pay you!" makes me want to Hulk Smash the lot of them 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJune 19, 2014 at 7:15 pm #110700bionaryMemberyeah, sounds pretty sketchy. I'll definitely be looking to create some form of "legit" backlinking strategy (since we're now on the topic).
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.