posts

Paginating get_posts() in Wordpress

杀马特。学长 韩版系。学妹 提交于 2019-12-11 04:09:58
问题 This a template page in my wordpress (have removed html), it pulls out the posts from my wordpress database. I want to paginate it but have no idea! :( I wan't to get something like this << First Prev 1 2 3 4 Next Last >> <?php $postslist = get_posts('numberposts=10&order=ASC'); foreach ($postslist as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a></li> <li><?php the_excerpt(); ?></li><br/><hr/> <?php endforeach; ?> 回答1: Here's a

Facebook graph “user/home” feed now contains activities as post items that are difficult to identify

。_饼干妹妹 提交于 2019-12-10 18:03:57
问题 When I make the Graph call https://graph.facebook.com/me/home , I get back a paged set of the posts on my feed. Recently, I've started to get items that appear to represent things like "John Doe liked a page". They are marked as a link, but if I ask FB for the item, I get back a status post. Here's an example, scrubbed of personal data: { application = { id = 2530096808; name = Pages; }; comments = { count = 0; }; "created_time" = "2011-08-28T18:54:09+0000"; description = "some text"; from =

Get facebook friends posts using graph API

北战南征 提交于 2019-12-10 13:47:51
问题 I am trying to build an application which requires access to friend's feed posts. Is it possible to retrieve friend's wall posts using graph API? I checked out in the developer console and found no such funstionality. If possible can someone explain me how do i go about retrieving it? 回答1: friend permissions are gone, and read_stream will not get approved by Facebook unless you are building an App for a platform without a native Facebook client. So there is no way to get access to friend

Wordpress search bar outputting only posts titles

我的未来我决定 提交于 2019-12-10 11:28:35
问题 I would like to create a Wordpress search bar in PHP, displayed in just one page of my site (I am working on a new theme I have made). As result, the search bar should output only the permalinks (titles) of my posts that are related to the search keyword. The issue I have now is that the search output is showing lorem ipsum text and the sidebar. Whatever keywords I search, that same output is showing up. (see screenshot). Thank you very much for your help! searchform.php <form role="search"

Firebase Database - Admin Panel

北城余情 提交于 2019-12-09 13:30:43
问题 I am new to Firebase and want to provide an easy to use panel to my client for adding, editing and removing posts. In my earlier apps, I used Heroku - Django combo that gave me a pre-built easy to customize admin panel that was very friendly for my client to use I want something similar for my Firebase app that can be used to make modifications to database , I know there is database console to deal with this stuff but its just not user friendly , specially for someone with no technical

Wordpress: Query Posts without allocated taxonomies

给你一囗甜甜゛ 提交于 2019-12-09 13:11:31
问题 I would like to filter all post queries by a specific term of a custom taxonomy (specified by an url). Currently I'm using add_filter('request', ...) and 'tax_query', which kind of works now. So I get all posts of this term, but I would like to get those posts, which do not have ANY terms allocated of this taxonomy. I was trying something like: $request['tax_query'] = array( 'relation' => 'OR', array( 'taxonomy' => 'brand', 'field' => 'slug', 'terms' => array( $term ) ), array( 'taxonomy' =>

Wordpress, filter posts if custom query variables are present. (pre_get_posts, add_vars)

我怕爱的太早我们不能终老 提交于 2019-12-08 07:01:01
问题 Basically, what I'm trying to do is filter my query if several variables are present, so that I can have something setup like this: Posts Filter Mockup I can do this with query_posts() , but I know that's terrible practice. So far, I've registered a couple of the query vars that I need to use, and I guess I just need to know how to include them in the query. Apparently what I'm using just doesn't work. // Add query vars for filtering by specific category ids add_filter('query_vars', 'add_vars

WordPress get_posts by title like

无人久伴 提交于 2019-12-07 14:10:21
问题 I am trying to create a small search-function for WordPress. An AJAX call should get all posts where the title is like %quote% . Is there a possibility to make this happen inside the get_posts() function? Don't get me wrong. The ajax works fine. I have the ajax function in my functions.php and I receive the posts. It's just the "where title like" part where I couldn't find a solution. 回答1: No, but you can create a custom loop. Check this. EDIT: $args = array('s' => 'keyword'); $the_query =

Wordpress search bar outputting only posts titles

為{幸葍}努か 提交于 2019-12-06 06:59:48
I would like to create a Wordpress search bar in PHP, displayed in just one page of my site (I am working on a new theme I have made). As result, the search bar should output only the permalinks (titles) of my posts that are related to the search keyword. The issue I have now is that the search output is showing lorem ipsum text and the sidebar. Whatever keywords I search, that same output is showing up. (see screenshot). Thank you very much for your help! searchform.php <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <label> <span class="screen

How to get Posts Greater Than X (ID) using get_posts

元气小坏坏 提交于 2019-12-06 06:23:20
问题 $args = array('numberposts' => 10, 'tag' => 'my-tag', 'ID' => 555'); $posts = get_posts($args); I want to bring only 10 records from an specific tag and that the ID is less than a number. Is there any way to do this with the get_posts arguments? How can I specify Greater Than, Less Than or Not Like in the arguments array? Thanks... 回答1: A nice solution if you want to get the posts with an ID lower than X: $post_ids = range(1, 555); $args = array('numberposts' => 10, 'tag' => 'my-tag', 'post_