Can I include get_posts in this array?

I’m assuming there is an option in the array that is meant to receive an array of options for the checkboxes…? In which case, you can use get_posts to obtain an array of post objects (of which ever type), and then loop through this, to create an array of post titles: For example.. $args=array(‘numberposts’=>-1,’post_type’ => … Read more

the-events-calendar, pagination with tribe_get_events()

Set the offset manually. $offset = ( get_query_var( ‘page’ ) ) ? get_query_var( ‘page’ ) : my_parse_url_for_offset(); function my_parse_url_for_offset() { if( strpos( $_SERVER[‘REQUEST_URI’], ‘/page/’ ) !== false ) { $url = explode( “https://wordpress.stackexchange.com/”, $_SERVER[‘REQUEST_URI’] ); $url_c = count( $url ); for( $i = 0; $i < $url_c; $i++ ) { if( $url[$i] == ‘page’ ) … Read more

Getting the list of the latests posts and custom type posts in the homepage

The post_type argument of the get_posts() function is for retrieving different types of post content. I’m assuming here that ‘work’, ‘photo’, and ‘code’ are custom post types. Grabbing multiple post types with WP_Query Instead of using get_posts(), you can use the WP_Query class to grab multiple post types. I just tested the following on my … Read more

Single random post in homepage

how to show the full post: http://codex.wordpress.org/Customizing_the_Read_More#More_about_.24more I want all the things I get in single.php possibly copy all the code from within the loop of single.php into the loop of your random post. my custom code … doesn’t work in index the in_category() code might only work within the loop or needs refining – … Read more

Why always one post missing

It sounds like you have a filter running on that page that’s adding an offset parameter to your WP_Query. There aren’t any really easy ways to search for all filters. The plugin Hikari Hooks is the simplest that I’ve seen. If you install and activate that plugin and view the problem page, you should be … Read more

Add class to every other posts using get_posts

A simple solution would be to add an alternating class to every other post in the list. In particular, (in your style.css) style the list elements <li> in one particular way, and then over-ride that style for list elements of a particular class <li class=”my-alternate-class”>. The class my-alternate-cass will applied to every other list element: … Read more

Adding paging to get_posts()

If you make paged equal to get_query_var( ‘paged’ ) that should do the trick. You may need to do something like $paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1; and then set paged to $paged.

loop inside a loop : search for posts in the same category

the_ID() prints the current post’s ID. You need to use get_the_ID() to return it. Also, get_the_category returns an array of category objects – one foreach category term the post belongs to. The ‘category’ attribute expects a category term ID. So you need to pick a category object, then obtain its ID: $cats = get_the_category(); $cat_obj … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)