WORDPRESS PLUGIN DEVELOPMENT

WordPress Plugin Development Tutorials, Tips, Tricks, Hacks.

  • HOW TO GET ALL POST IN WORDPRESS QUERY

    AUTHOR: // CATEGORY: WordPress, WordPress Plugin Development, WordPress Theme Development

    No Comments

    To get all the post in returned WordPress query results, you have to put: ‘posts_per_page’ => -1 in query arguments. For example:

    $all_posts = get_posts( array(
    	'post_type'	   => 'post', // e. g. custom_post_type
    	'orderby'          => 'post_date',
            'order'            => 'DESC',
    	'posts_per_page'   => -1,
    ) );
    
    LinkedInShare
  • CUSTOM POST TYPE & CUSTOM TAXONOMY’S URL REWRITE TO REMOVE THEIR SLUGS

    AUTHOR: // CATEGORY: WordPress, WordPress Plugin Development, WordPress Theme Development

    No Comments

    If you ever need to remove slug completely from your WordPress’s URLs for Custom Post Type or Custom Taxonomy, set ‘slug’ to ‘/’ and ‘with_front’ to ‘FALSE’ for rewrite parameter while registering custom post type or custom taxonomy.

    'rewrite' => array(
                   'slug'       => '/', 
                   'with_front' => FALSE
                 ),
    

    Don’t forget to visit Settings->Permalinks page to flush old url rewriting rules to update changes.

    LinkedInShare
  • HOW TO CONFIGURE (SETUP) APTANA STUDIO FOR WORDPRESS DEVELOPMENT

    AUTHOR: // CATEGORY: Aptana Studio, PHP, WordPress, WordPress Plugin Development, WordPress Theme Development

    No Comments

    Sometimes Aptana Studio doesn’t give code hinting for WordPress Development, if you face this problem, try this:
    1. go to File -> New -> Other -> or just click ctrl+N.
    2. New dialog window will open, from there choose Project under General Category, click next.
    3. On Project Screen type a name for your project e.g. ‘WordPress Development’ and uncheck ‘Use Default Location’.
    4. Click browse button on the right for location and select your WordPress installation folder e.g. c:\xampp\htdocs\wordpress_development. Click Finish.
    5. Now right click on your WordPress Development (your project created above) in Project Explorer and select Properties.
    6. ‘Properties for WordPress Development’ window will pop up, from there click on ‘Project Natures’.
    Check ‘PHP’ and ‘Web’ from the right panel, make sure PHP is highlighted as Primary.
    Then click OK to close Properties Dialog window.
    Now Aptana Studio will reconfigure your project accorinding to PHP as Project Nature and will ask you to close and reopen the project, click Yes to accept so.
    Now you may see your porject as closed project on Project Manager, if so double click to open your newly created project and you are done.
    Try creating a test plugin under wp-content/plugins directory and you will get code hinting for WordPress.

    LinkedInShare