Displaying Posts

  • Unknown's avatar

    Number 1: using the short code on a ‘Posts’ page, it’s not displaying all of my posts (by category, which I’ve told it to do). I checked to make sure all pages are assigned a category and that the code will display enough posts to show them all.

    Number 2, I want to style my list of posts in DIVs like the nice ones on the ‘Category Options’ Home page examples: https://categoryoptions.wordpress.com. How do I do that? That would make me very happy!

    Thank you!
    Cheers~James

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi James,

    1. Can you provide the display posts shortcode that you used on the Posts page that you refer to? And a link to the page if it still contains the display posts shortcode list.

    2. Each page on the Category Options site that have display posts shortcode inserted in them show the code at the top of the page. Example: the shortcode for the page Display Post Code (Image and Excerpts) is given as the following:

    [display-posts category=”category-3″ posts_per_page=”10″ order=”ASC” orderby=”title” include_excerpt=”true” image_size=”thumbnail”]

    The arguments used in the shortcode may be found in the Display Arguments section of the Display Posts Shortcode support page.

    doc

  • Unknown's avatar

    Hi, Jim,
    Thanks so much for helping me here.

    1. Here is the short code I currently have with just a few categories:

    [display-posts category="19th Century Houses, Architecture, American Landscape" order="DESC" posts_per_page="40"]

    The ‘American Landscape’ category is not displaying.

    I’ve been working with this today trying to add categories one at a time and try to troubleshoot it. So, I looked in my list of categories under ‘Settings’ and clicked ‘display posts’ for the American Landscape category. It shows that there are 4 posts using that category, but when I click to see the list of posts it says, “No posts.” Weird…so whatever is causing them to not show is keeping them from displaying, I would bet. Armed with that knowledge I’m going to try and find out what it is. And maybe you could hazard a guess as well?

    2. Here I was just wondering how to style each item so nicely as on the Category Options site instead of just an HTML 101 bulleted list. You know, with the nice formatting—category name, title, date with attendant typography, and a picture. I do have the arguments page bookmarked as well, thank you. But in that page it says for the wrapper you can have them display as a list “or divs (div) which you can then style yourself.” How do I style the DIVs?

    Thanks!

    James

  • Unknown's avatar

    Some posts, even though they’re tagged as a certain category, don’t show up in that category’s list, and they don’t appear when that category is called in the short code page. I wonder if this has anything to do with my re-importing the site. It was down for a while; I saved it as XML and now I’m bringing it back under a new domain. Maybe that’s an issue?

  • Unknown's avatar

    AH!…I took out the ‘order’ argument and it’s displaying now.

  • Unknown's avatar

    I still have the problem of “No posts found” being returned when I click to view the posts in a category, even though it shows there are several…

  • Unknown's avatar

    James,

    The items in this response refer to those in your last enumerated post above.

    1. Is this display posts shortcode inserted into a page that is presently published, or a draft page? Here’s your category pages for the categories “American Landscape” and “19th Century Houses”:

    It’s pretty clear that the reason your shortcode doesn’t include posts in the American Landscape category is due to the fact that the slug for that category is “american_landscape” — with the two words separated by an underscore instead of a hyphen.

    WordPress.com might accept “American Landscape” in your code instead of “american-landscape,” but the code “american_landscape” is interpreted as a different category, in this case a non-existent one.

    2. The wrapper style “divs” (div) in the Display Arguments section of the Display Posts Shortcode support page refers to one of the three available list styles, which are ordered (ol), unordered (ul), and divs (div). Using the argument wrapper=”div” simply results in the list being displayed without numbers (ordered list), or bullets (unordered list).

    I’m not sure where at the Category Options site you’re seeing the nice formatting that you mention, or posts that include dates and “attendant typography.” The pages with display lists shortcode are all pretty basic. Examples:

    I suspect that you might be referring to other pages on the Category Options site, such as the one titled “Category Page.” Those are automatically generated category pages, similar to those on your site that I’ve linked to above, with the style being determined by the theme applied, in this case the premium theme Olsen.

  • Unknown's avatar

    Correction and clarification of the paragraph in my previous post regarding category slugs:

    The slug “american_landscape” is not “non-existent,” as I incorrectly said above. It is the slug of your category “American Landscape,” and it can be seen in the URL of the corresponding category page: https://jamestcallahanphotographer.wordpress.com/category/american_landscape/. The problem of the display posts shortcode not showing posts with the “American Landscape” category assigned can be fixed by changing either the slug in the category itself or the slug in your display posts shortcode so that they agree.

  • Unknown's avatar

    OK, thank you! Let me take a look at all of this but thanks for your help. Greatly appreciated.

    James

  • Unknown's avatar

    OK< we’re getting closer now. They’re all displaying except for two: ‘american small towns’ and ‘science and engineering.’

    I navigated to WP Admin>Posts>Categories where it shows a list of categories and the slug for each, but inputting those two slugs into the short code doesn’t make those posts display on the resulting Posts page…

    I also tried using underscores or nothing at all. Same result. Where is it that I can edit the slugs, anyway?

    Thank you!

  • Unknown's avatar

    I navigated to WP Admin>Posts>Categories where it shows a list of categories and the slug for each, but inputting those two slugs into the short code doesn’t make those posts display on the resulting Posts page…

    Some category slugs as presently found on your site:
    American Landscape: american_landscape
    American Small Towns: american_small_town (singular noun)
    Science and Engineering: science

    So modifying the display posts shortcode that you provided above to include those three would yield:

    [display-posts category="19th-century-houses, architecture, american_landscape, american_small_town, science" order="DESC" posts_per_page="40"]

    If the total of posts in those five categories is less than or equal to 40, then they should all display in the list that this shortcode produces.

    Where is it that I can edit the slugs, anyway?

    Years ago it was possible to edit the slugs directly at WP Admin>Posts>Categories. Today I find that I still edit post category slugs, but it must be done indirectly by editing the category name, because there’s no direct access to the slug. However, in my tests the only way to obtain a slug with an underscore between two words is two include the underscore between the words in the category name. So I don’t know how in some cases your category names have no underscores while the slugs have them. Examples:

    (category name) American Small Towns………. (slug) american_small_town
    (category name) American Landscape…………..(slug) american_landscape

    I’ve been unable to reproduce this disparity between category name and category slug with respect to underscores, so I’ll call for staff attention again. Staff should respond here.

  • Unknown's avatar

    An alternative to using display posts shortcode to display posts in those five categories that you might consider is to create a top level menu item called “Five Post Categories” or something like that and then to include a link to each of the categories in a drop-down menu below the top-level item. Or have a top-level item called “Post Categories,” with a drop-down menu below it that includes all categories, but also has a sub-menu within it that only includes some of the categories.

    How to do create and reorder drop-down menus is described and illustrated (with GIFs) in the Add Menu Items (Choose from the Categories type) and Reorder Menu Items & Add Drop-Down Menus sections of the Custom Menus support page.

  • Unknown's avatar

    “How to create and reorder”

  • Unknown's avatar

    Thank you, Jim! you’ve saved me many hours of frustration…yes, I can’t explain the disparity in slug names. But I’ve got all of them displaying now.

    However, I like your alternative suggestion. This is what I originally wanted to do and was going to spend some time getting done. I think that is the solution I want…it’s the most elegant one, and you’ve pointed me in the direction of the documentation, so thank you again, although I’m pretty good with creating menus so I should be fine.

    Thank you so much for all your help! I owe you many pints of Guinness :)

    Cheers ~James

  • Unknown's avatar

    You’re welcome, James!

    Cheers ~doc

  • Unknown's avatar

    I just realized that I marked this issue as ‘resolved’, and it is, for my immediate purposes, but I would like to see if we can determine the cause of the category slug disparity.

    Thanks!

  • Unknown's avatar

    Okay, James. I’ve added the “modlook” tag to call for staff attention again. Just a note: I think I mistakenly used the word “disparity” instead of “descrepancy” or “disagreement.”

    Staff:
    The discrepancy we’re referring to is described in the last paragraph of reply #3373297 above.

  • Unknown's avatar

    “discrepancy” not “descrepancy”

  • Unknown's avatar
  • It looks like you have tags that are exactly identical to your categories, with the same slugs according to the tag and category lists in WP-Admin:

    https://jamestcallahanphotographer.wordpress.com/wp-admin/edit-tags.php?taxonomy=post_tag

    https://jamestcallahanphotographer.wordpress.com/wp-admin/edit-tags.php?taxonomy=category

    The WordPress software (as in the open source software made on WordPress.org, which we use here on WordPress.com) doesn’t like this, so I’m guessing in the database the category slugs automatically updated to underscores instead. I’m not sure why it didn’t update the category list as well, but that’s likely related to how these categories were added – usually a number is just appended to the duplicate slug, but something could also have changed recently in how the WordPress software handles this.

    Using the same term as a tag and category on the same post is never recommended, as any term should only be used once in any particular post’s taxonomies. So I would recommend that you delete all the tags that are duplicates of categories. Then change the category by modifying one letter, save, and change it back. Hopefully that will update them to use hyphens instead.

    If you just update the category to something different than the tag without deleting the tag, that should also do the trick.

    Of course, either way you’ll have to update your shortcode again to reflect the updated slugs.

  • The topic ‘Displaying Posts’ is closed to new replies.