See whole article: WordPressium: Creating a Medium-like Experience
Author: Marcin Pietrzak
3.3.28
- IMPROVMENT: added Slovak translation by Daniel Schmidt
3.3.27
- IMPROVMENT: added Dutch translation by Ruud Kok
3.3.26
- BUGFIX: fixed empty post_type value thx to Zeus UpPrev error – array_key_exists()!
- IMPROVMENT: added Italian translation by Francesco Giossi
How to add Facebook like button to upPrev box?
You can use iworks_upprev_box_item filter, to modify item element.
<?php
add_filter( 'iworks_upprev_box_item', 'iworks_upprev_box_facebook_like' );
function iworks_upprev_box_facebook_like($content)
{
/**
* change this for your data
*/
$appId = 279100175534801;
$like_page = site_url();
ob_start();
?>
<hr />
<div id="fb-root"&</div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/<?php echo get_locale(); ?>/all.js#xfbml=1&appId=<?php echo $appId; ?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</>
<div class="fb-like" data-href="<?php echo $like_page; ?>" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>
<?php
$content .= ob_get_contents();
ob_end_clean();
return $content;
}
Get code: upprev_add_fb_like_to_box.php
Where to put this code?
There are three ways:
- made a one-file-plugin and put file into
wp-content/plugins, then turn it on - made a one-file-plugin and put file into
wp-content/mu-plugins - put this code into
functions.phpin current theme
I recommend using option 1 or 2, but 3 is the easiest.
3.3.25
- IMPROVMENT: updated Simplified Chinese translation by Leo
- IMPROVMENT: added filter ‘iworks_upprev_box_title‘ for box title, return false to remove title
3.2.24
- BUGFIX: prevent to display upPrev box on attachment page thx to Swaps4 Upprev displaying on attachment pages with no styling
- BUGFIX: remove add_contextual_help function (deprecated from 3.3).
- IMPROVMENT: updated IworksOptionClass to 2.0.0
3.3.23
- BUGFIX: default value only when is need thx to Jeff Offset Not Working
- IMPROVMENT: updated IworksOptionClass to 1.7.7
3.3.22
- IMPROVMENT: add iworks_upprev_check filter, see documentation: Filter Reference – iworks_upprev_check
3.3.21
- BUGFIX: replace WP_PLUGIN_URL with plugins_url() thx to [tigr – SSL compatibility