Git Product home page Git Product logo

wedevs-favorite-post's Introduction

Favorite Posts

This is a simple yet another favorite post plugin.

Features

  1. Gives a button to favorite a post.
  2. Works only for logged in users.
  3. Has a favorite post widget
  4. Custom post type support

Usage

  1. Insert <?php if ( function_exists( 'wfp_button' ) ) wfp_button(); ?> this code in your post page to show a favorite post link.
  2. $favorites = WeDevs_Favorite_Posts::init()->get_favorites(); - get favorite posts. Supports 3 parameters, post_type, limit, offset. The default post_type is all, for getting all post types.
  3. Show favorite posts in a widget.
  4. Use the shortcode [favorite-post-btn] for inserting the favorite post link. You can also pass a post id as a parameter. [favorite-post-btn post_id="938"].
  5. Use the shortcode [favorite-post] to display favorited posts. You can also pass these parameters: user_id, count, post_type. e.g. [favorite-post user_id="1" count="5" post_type="all"]

Author

Tareq Hasan

wedevs-favorite-post's People

Contributors

tareq1988 avatar codemascot avatar kyrillgr avatar

Stargazers

Rihards Mantejs avatar Raihan avatar  avatar Ebrahim khan avatar AB Siddik avatar Dinesh Kesarwani avatar Cat  avatar Jay Fraser avatar Amos Lee avatar Björn Kuipers avatar Sanchit Soni avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar  avatar  avatar

wedevs-favorite-post's Issues

Add filters to shortcode.

Hello. I get a project with yours Wordpress Plugin Version: 0.1 Favorite Posts. I'm beginner in wordpress develop. If you could answer a few questions I would be happy.

I see that you register shortvode in constructor on 91 line in wp-content/plugins/favorite-post/favorite-post.php

add_shortcode( 'favorite-post', array($this, 'display_shortcode') );

and on the display_shortcode function you proccessed all shortcode calls

$atts = extract( shortcode_atts( array('user_id' => 0, 'count' => 10, 'post_type' => 'all', 'remove_link' => false), $atts ) );

But i don't understand how i can to intercept this execution, because you not set name of short code on shortcode_atts function (3rd argument)

May be it must be as

$atts = extract( shortcode_atts( array('user_id' => 0, 'count' => 10, 'post_type' => 'all', 'remove_link' => false), $atts, 'favorite-post') );

Thanks!

Store multiple values in single field

Is it possible to store all the favorited post ID of each user in a single field separated by comma? so that there will be only single row for each user_id.

For eg:
user_id 5
post_id 2,7,14,23

Thanks

Output number of favorites

Hi Tareq how are you? I'am looking for a simple way to output total number of favorites for each post. I'm using code below into my functions:

// Count number of posts
function getFavNumber($postID){
$count_key = 'post_fav_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return '0 Favorites';
}
return $count.' Favorites';
}

// Count Favorites
function setFavNumber($postID) {
$count_key = 'post_fav_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}

Feature Request

Is there anyway of pulling in a page/post's feature image? Would be very handy for icons

Favorite count

Hi Tareq,

I was wondering if it's possible to show the amount of clicks on the 'favorites' button per post.

Pieter

Best practices?

Hello,

i'm a niewbie in wp, and i want to try your plugin.

could you please desribe 2nd point in README? where should i put this function?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.