posts

User Submitted Posts using Laravel

不羁岁月 提交于 2019-12-24 07:37:19
问题 I am trying to build an application wich it will contain an admin dashboard where the admin will be able to CRUD Posts but also he will be able just to see User Submitted Posts. On the other hand the guest will be able to just see the Posts, but he will be able to Create User Submitted Posts. Until now I have managed to get the Posts functionallity working, but not for the User Submitted Posts. My Controller: namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Usp; class

Facebook Graph API - Page - Scheduled posts not coming back in promotable posts call

大兔子大兔子 提交于 2019-12-24 07:17:08
问题 I'm trying to list all future scheduled posts for a business page but when I request promotable posts as per the documentation graph.facebook.com//promotable_posts its not pulling back unscheduled posts with one exception - directly after I initially create a new scheduled post. I can't figure out why but this is the only time it will pull back the list and it will only do it for the first request after a new post not subsequent. Any ideas ? 来源: https://stackoverflow.com/questions/19171051

Retrieve certain posts by their number?

蓝咒 提交于 2019-12-24 07:05:38
问题 How can I call certain posts by their number to place them as featured posts in specific places of my template ? I've read about sticky posts , But I have about 3 places to place my featured posts and I guess I need a loop to get posts by their number I defined. Any HELP ?! 回答1: <?php // The Query $query = new WP_Query( 'p=7' ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata(); ?>

How to add category to all post by using sql query?

房东的猫 提交于 2019-12-24 00:44:49
问题 I have a thousand posts and all them don't have category. So, Do you know how to associate category with all posts by using sql query ? Thank you ! 回答1: don't need to use mySql, you can do it with bulk actions in your wp admin Create your categories as usual. Go to your entries and select them all Select in bulk actions / edit Edit all at once. 回答2: First you need to know the id of you category you want your posts to be associated with. Look in the table wp_terms column term_id. INSERT INTO

If first post, style differently — Wordpress [closed]

谁说胖子不能爱 提交于 2019-12-19 11:34:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need the first post that was ever posted to be styled differently. Is there a way that I can see if the post is first, and then change its contents? I currently have a div in all my posts. This needs to be replaced with different div . Apparently the following piece of code can

Wordpress Loop posts in Bootstrap 3 grid layout

ⅰ亾dé卋堺 提交于 2019-12-17 17:38:30
问题 I am using Bootstrap 3 within Wordpess and have an issue getting my archive posts to display across the page in a grid format. My wordpress loop code is... <?php if ( have_posts() ) : ?> <?php $args=array( 'post_type' => 'artist', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { echo ''; while ($my_query->have_posts()) : $my_query->the_post(); ?> <li> <img src="<?php the_field(

show only posts created in last week

こ雲淡風輕ζ 提交于 2019-12-14 00:23:38
问题 I want to be able to show posts and have them sorted by a couple criteria, first by the amount of votes they have on them and second by the date at which they were created. I don't want posts that are more than a week old being displayed so only posts in the last week. I tried doing this: <%= render @posts.sort_by { |post| post.votes.count if post.created_at < 1.week.ago.utc }.reverse %> but it gave me an error of comparison of NilClass with 2 failed I know the code works by just sorting

CakePHP - Relationship Question - Posts.Child belongsTo User, How to define?

亡梦爱人 提交于 2019-12-13 06:08:48
问题 Below is a posts model, and as you can see I have a belongsTo relationship on each post, so that the user details are also retrieved with the post. I would also like the exact same behaviour for the Posts.Children (see the hasMany definition below). QUESTION: How do I also apply the belongsTo relationship to the Posts.Children ( Posts.Child belongsTo User )?? <?php class Post extends AppModel { var $name = 'Post'; var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' =>

Open wordpress post in a different page

你说的曾经没有我的故事 提交于 2019-12-13 04:46:57
问题 I have two separate pages showing a list of different categories linking to the full post in wordpress. These both currently open on single.php in my theme but The categories need to be styled differently on each page. I have created the template page but do not know how to open posts on another page other than single.php to simplify: how do I open posts on another version of single.php the code I have that opens the full posts are: <?php // PAGE LINK/TITLE if (is_page()) { $cat=get_cat_ID(

Making public posts via Facebook App?

左心房为你撑大大i 提交于 2019-12-12 21:37:31
问题 I recently noticed that posts from my app were going to all-friends even when I requested they be public. Through the response to my bug report (https://developers.facebook.com/bugs/191063590970288) I learned about the "App activity privacy" setting buried in the user privacy settings but I don't see anything in the FB developer docs about this. Even if it's not something an app can request a default permission for, it would be nice if there was some mention of it on the privacy or post