Support » Plugin: Lana Downloads Manager » Get all sub-categories and download post id

  • Resolved kaffemyers

    (@kaffemyers)


    Hi,

    I’m gonna try to work with the Lana DM to create some custom code to ease maintenance of a site. However, I have no experiencing developing functions for wordpress.

    I wonder if you have some php code examples of getting all sub-categories of a parent, and all download post ids of a category?

    I figure it wouldn’t hurt to ask, at least.

    Regardless, thanks for this nice plugin. :]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Lana Codes

    (@lanacodes)

    Yes, I have a plugin, hopefully it will help.

    lana-downloads-manager-category-widgets-addon.zip

    This is a widget plugin that lists by category.

    If you have any questions, please feel free to contact me.

    Thread Starter kaffemyers

    (@kaffemyers)

    Swift reply!

    Thanks, I’ll have a look at that!

    Thread Starter kaffemyers

    (@kaffemyers)

    OK, I don’t really know how to do trial and error coding here, and as I’m currently doing it, it is very inefficient. I type in Code Snippets and if things go south it reverts to the last save. I’m not gonna bother you over and over, but maybe you could just set me on the right path to get a result whatsoever and I’ll go digging some after that. I’m used to coding, just not php, and especially not in a wordpress environment with a web-gui editor. xD

    I see this code (copy pasta further down), and I believe this could be (at first) hardcoded with a download category ID. I installed the plugin and can see that the category ID is represented in the dropdown list in the widget area. I see $instance[‘download_category_id’] and go “aha, I can just insert it there!”

    I tried with both int and string, but foreach-echoing the results breaks the page.

    I have the feeling that if I just understand this part, the rest will fall into place with a bit of determination, but I think I need a push to keep the motivation going.

    		$lana_downloads = get_posts( array(
    			'post_type'   => 'lana_download',
    			'numberposts' => - 1,
    			'tax_query'   => array(
    				array(
    					'taxonomy'         => 'lana_download_category',
    					'field'            => 'id',
    					'terms'            => $instance['download_category_id'],
    					'include_children' => false
    				)
    			)
    		) );
    
    Thread Starter kaffemyers

    (@kaffemyers)

    Hmmm, OK, I figured it out.

    I just had to show some weakness to get myself in check.

    Thanks for the code!

    Thread Starter kaffemyers

    (@kaffemyers)

    Work has been fruitful since I was here last. Thanks for the help!

    Plugin Author Lana Codes

    (@lanacodes)

    Awesome. If you need anything else, let me know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Get all sub-categories and download post id’ is closed to new replies.