Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

widgets

Including Custom Post Types in “Recent Posts” Widget

August 2, 2022August 1, 2022 by Magenaut

I’m able to easily include my custom post types into my main loop by making small adjustments with query_posts(), but I’m not sure how I would go about including custom post types in the “Recent Posts” sidebar widget (or any of the other widgets, for that matter).

Categories Q&A, Wordpress Tags custom-post-types, sidebar, widgets Leave a comment

Add class to before_widget from within a custom widget

August 1, 2022July 31, 2022 by Magenaut

I have a simple custom widget that asks for its width (that is used later in the front end). The width field is a select dropdown, so a user have predefined options.

Categories Q&A, Wordpress Tags core-modifications, hacks, widgets Leave a comment

Create variable from widget instance

August 1, 2022July 31, 2022 by Magenaut

Is it possible to return a widget instance into a variable or array? I’m thinking something along the lines of $widget['title'], $widget['content'] etc.

Categories Q&A, Wordpress Tags sidebar, widgets Leave a comment

How to get post ID of the current page/post inside a widget?

August 1, 2022July 31, 2022 by Magenaut

I’m trying hard to get the post ID of the current post/page inside a widget class but doesn’t work, I know there’s get_the_ID() and some other options but not a single works inside a widget. Here’s my code:

Categories Q&A, Wordpress Tags posts, widgets Leave a comment
Newer posts
← Previous Page1 … Page6 Page7
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress