Skip to content

Commit

Permalink
Updating shortcode generator to use the new tabs interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronjonesweb committed May 28, 2016
1 parent 1bb74c8 commit f05fa99
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
10 changes: 9 additions & 1 deletion facebook-page-feed-graph-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,15 @@ function generate() {
$return .= '<p><label>' . __( 'Height (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" min="70" id="fbpp-height" /></label></p>';
$return .= '<p><label>' . __( 'Show Cover Photo', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cover" /></label></p>';
$return .= '<p><label>' . __( 'Show Facepile', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
$return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-tabs"><option value="">None</option><option value="timeline">Timeline</option><option value="messages">Messages</option><option value="timeline,messages">Timeline, Messages</option><option value="messages,timeline">Messages, Timeline</option></select></label></p>';
$return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ':';
if( !empty( CJW_FBPP_TABS ) ) {
foreach( CJW_FBPP_TABS as $tab ) {
$return .= '<br/><label>';
$return .= '<input type="checkbox" class="fbpp-tabs" name="' . $tab . '" /> ';
$return .= ucfirst( $tab );
$return .= '</label>';
}
}
$return .= '<p><label>' . __( 'Hide Call To Action', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cta" /></label></p>';
$return .= '<p><label>' . __( 'Small Header', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-small" /></label></p>';
$return .= '<p><label>' . __( 'Adaptive Width', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-adapt" checked /></label></p>';
Expand Down
18 changes: 16 additions & 2 deletions js/facebook-page-plugin-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,22 @@
$shortcode += 'cover="' + $cover + '" ';
var $facepile = $('#fbpp-facepile').prop("checked");
$shortcode += 'facepile="' + $facepile + '" ';
var $tabs = $('#fbpp-tabs').val();
$shortcode += 'tabs="' + $tabs + '" ';
var $tabs = [];
$('.fbpp-tabs').each(function(){
if( $(this).prop('checked') == true ) {
$tabs.push( $(this).attr('name' ) );
}
});
if($tabs.length > 0){
var $tabstring = '';
for( $i = 0; $i < $tabs.length; $i++ ) {
$tabstring += $tabs[$i];
if( $i != $tabs.length - 1 ) {
$tabstring += ','
}
}
$shortcode += 'tabs="' + $tabstring + '" ';
}
var $cta = $('#fbpp-cta').prop("checked");
$shortcode += 'cta="' + $cta + '" ';
var $small = $('#fbpp-small').prop("checked");
Expand Down

0 comments on commit f05fa99

Please sign in to comment.