• Resolved svenbergvall

    (@svenbergvall)


    Hi, is there any possibility to always get current category, i.e. using the %s under the “Get posts with these categories” label?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Aldo Latino

    (@aldolat)

    Hi,
    do you mean: how to display the name of the category in the widget title when you set up a category in the field “Get posts with these categories”?

    Thread Starter svenbergvall

    (@svenbergvall)

    Hi, I’m actually trying to display posts related to the current page, which I had hoped would work with the %s, but it doesn’t show anything when I use it in the “getting posts/Get posts with these categories”

    Plugin Author Aldo Latino

    (@aldolat)

    If for “current page” you mean a WordPress standard page (i.e. a page created in the menu Pages > Add new), you cannot grab pages related to the current page because they have not any taxonomy.

    If you mean a blog post page, in this case posts can have taxonomies. Currently you can grab posts related to the current post using the category of the current post (I explained it here). There is a dedicated section in the widget admin for this.

    In this section, the %s placeholder is used to display, in the widget title, the category where the posts are retrieved from. It’s used only for this scope.

    Please, let me know if I am correctly understanding your needs.

    Plugin Author Aldo Latino

    (@aldolat)

    Hi @svenbergvall
    to get posts related to the current main post, use this:

    1) Go to Getting posts > Change the query when on single posts > Get posts from current category
    2) Activate the option “When on single posts, get posts from the current category”
    3) In “When on single posts, get this number of posts” enter the number of posts you want to show
    4) In “When on single posts, use this widget title” enter the title using this string: “Posts under %s” (without quotes)
    5) Activate the option “Sort categories”.

    Save the widget and go to your site, in the frontend. Open a post and the widget should display a list of posts related to the current viewed main post.

    Let me know if it helps.

    Plugin Author Aldo Latino

    (@aldolat)

    Marking this thread as resolved. Please, fell free to reopen it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘using %s also for Pages’ is closed to new replies.