• Hello guys,
    I have to create a widget that show the last post from only one category.

    1 – I copied the code of widget “WP_Widget_Recent_Posts” from default-widgets.php
    2 – Paste the code on the file function.php of my theme
    3 – change the code you just pasted and inserted
    register_widget ( ‘name_new_widget’);

    First i have to select only one category, I think it is the function to change
    $ r = new wp_query (array ( 'showposts' => $ number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
    ++add 'cat' => id_category_to_select
    (and it’s right, because i’have tested it whit the original widget_recent_post)

    The problem is: The widget is not visible in the widget page into admin.

    You can help me?

    Thank you, bye!
    Andrea

    PS. excuse me for me english, i’m italian ??

  • The topic ‘clone and modify a widget’ is closed to new replies.