1. Home
  2. Docs
  3. Social Feeder
  4. Developers
  5. Social Feeder Data Model

Social Feeder Data Model

SocialFeed data model (class) contains all configuration settings, can be used to check default settings, social network settings and other.

Get model

User global function get_social_feeder() to retrieve the loaded model from the database.

$social_feeder = get_social_feeder();

Properties

Property Type Description

theme

string

Selected theme ID.

limit

number

Selected limit value.

follow_us

boolean

Flag true|false that indicates if "Follow Us" links should be displayed.

date_format

string

Selected date format.

frequency

number

Selected cache refresh frequency in minutes.

enqueue_styles

boolean

Flag true|false that indicates if styles should be enqueued.

merge

boolean

Flag true|false that indicates if feeder should merge all feed.

twitter

boolean

Flag true|false that indicates if Twitter feed is enabled.

instagram

boolean

Flag true|false that indicates if Instagram feed is enabled.

facebook

boolean

Flag true|false that indicates if Facebook feed is enabled.

feeds

Dynamic property that returns a collection of Feed Models based on the current settings set in the model.

direction

string

Direction value assigned by Widget or Shortcode.

width

string

Max width (per feed) value assigned by Widget or Shortcode.

height

string

Max height (per feed) value assigned by Widget or Shortcode.

Methods

::save()

Saves changes made to the database.

$social_feeder->frequency = 60;
$social_feeder->save();

do_action( 'socialfeeder_saved', $social_feeder );

Customize

Model can be customized by creating a new PHP class and extending it.

use SocialFeeder\Models\SocialFeeder as Model;
use WPMVC\MVC\Traits\FindTrait;

class MyModel extends Model
{
    use FindTrait;
    
    /**
     * Field aliases and definitions.
     *
     * @var array
     */
    protected $aliases = [
        'follow_us'             => 'field_follow_us',
        'merge'                 => 'field_merge',
        ...
        // Copy thos from model.
        // The add yours
        'color' =>  'field_custom_color',        
    ];
}

The call it like this:

$social_feeder = MyModel::find();
Was this article helpful to you? Yes No