How to manage PHP Social Stream assets

In this article, I am going to show you how to manage PHP Social Stream asset files on your website.

1. First of all, disable automatically adding of asset (.css, .js) files in your social stream. e.g:


<?php
include( './social-stream/social-stream.php' ); // Path to PHP Social Stream main file
echo social_stream(
array(
'id' => '1',
'type' => 'wall',
'network' => array(
...
),
'theme' => 'sb-modern-light',
'breakpoints' => array('4', '4', '3', '3', '2', '1', '1'), // Number of items (columns)
'add_files' => false // Disable automatically adding asset (.css, .js) files
)
);
?>

2. Second, add asset files manually to top of your html content within <head></head> tag. e.g:


<head>
<?php
// For All - Common
echo '<link href="'.SB_PATH . 'public/css/colorbox.css" rel="stylesheet" type="text/css" />';
echo '<link href="'.SB_PATH . 'public/css/styles.min.css" rel="stylesheet" type="text/css" />';
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/jquery-1.12.4.min.js"></script>'; // You can remove this line if you already have jQuery added on the page
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/sb-utils.js"></script>';
// Only for wall
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/sb-wall.js"></script>';
// Only for timeline
echo '<link href="'.SB_PATH . 'public/css/timeline-styles.css" rel="stylesheet" type="text/css" />';
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/sb-timeline.js"></script>';
// Only for carousel
echo '<link href="'.SB_PATH . 'public/css/lightslider.css" rel="stylesheet" type="text/css" />';
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/sb-carousel.js"></script>';
// Only for rotating feed
echo '<script type="text/javascript" src="'.SB_PATH . 'public/js/sb-rotating.js"></script>';
?>
</head>

Make sure social-stream.php lib is included before all these codes.