How to count the current posts terms WordPress

wp_count_terms the function counts terms in a given taxonomy (e.g. total number of categories, total number of tags). To get what you want, get the terms for the post and just count them count( wp_get_post_terms( $post_id, $taxonomy, $args ) );. Or, assuming that in real life you might need those terms later: count() function help you to …

Read more

WP_Query count posts – custom Post Type

The wp_count_posts function has parameter $type for post type to count, you should use this parameter if you want to count the number of schusslersalz A snippet Full snippet as follow: I hope this code helped

How to set 777 permission on a particular folder?

777 is a permission in Unix based system with full read/write/execute permission to owner, group and everyone.. in general we give this permission to assets which are not much needed to be hidden from public on a web server, for example images.. You said I am using windows 7. if that means that your web server is Windows …

Read more

Categories PHP

Save Array in MySQL Database

You can store the array using serialize/unserialize. With that solution they cannot easily be used from other programming languages, so you may consider using json_encode/json_decode instead (which gives you a widely supported format). Avoid using implode/explode for this since you’ll probably end up with bugs or security flaws. To convert an array (or any object) into a string using PHP, call the …

Read more

Categories PHP

Subtract 1 Week with PHP

For Subtract 1 week use this code: Please replace your date with ‘2012-12-12‘. You Can Also Use This Code for Subtract 1 Week: Please replace your date with ‘2012-12-12‘.

Categories PHP

Subtract day with PHP

For Subtract 1 day use this code: please replace your date with ‘2012-12-12‘. For Subtract 7 days use this code: please replace your date with ‘2012-12-12‘. For Subtract 30 days use this code: please replace your date with ‘2012-12-12‘.

Categories PHP