Explanation of Use',
'More Plugins',
'Elegant Themes',
);
$links = array_merge( $links, $new_links );
}
return $links;
}
add_filter( 'plugin_row_meta', 'Alobaidi_Gallery_plugin_row_meta', 10, 2 );
// Add settings page link in before activate/deactivate links.
function Alobaidi_Gallery_plugin_action_links( $actions, $plugin_file ){
static $plugin;
if ( !isset($plugin) ){
$plugin = plugin_basename(__FILE__);
}
if ($plugin == $plugin_file) {
if ( is_ssl() ) {
$settings_link = 'Settings';
}else{
$settings_link = 'Settings';
}
$settings = array($settings_link);
$actions = array_merge($settings, $actions);
}
return $actions;
}
add_filter( 'plugin_action_links', 'Alobaidi_Gallery_plugin_action_links', 10, 5 );
// Include settings page
include ( plugin_dir_path(__FILE__).'/settings.php' );
// Redirect to gallery page
function Alobaidi_Gallery_redirect_to_gallery_page(){
if( get_option('alobaidi_gallery_home') and !is_feed() ){
$template = plugin_dir_path(__FILE__).'/template/gallery_page.php'; // gallery page url
include($template); // redirect to gallery page
exit(); // important!
}
else{
if( get_option('alobaidi_gallery_page') and !is_feed() ){
$url = get_option('alobaidi_gallery_page');
$page_id = url_to_postid($url);
if( is_page($page_id) ){
$template = plugin_dir_path(__FILE__).'/template/gallery_page.php'; // gallery page url
include($template); // redirect to gallery page
exit(); // important!
}
}
}
}
add_action( 'template_redirect', 'Alobaidi_Gallery_redirect_to_gallery_page' );
// Enqueue JS
function Alobaidi_Gallery_JS(){
wp_enqueue_script( 'alobaidi-gallery-fancybox-js', plugins_url( '/template/fancy/js/jquery.fancybox-1.3.7.js', __FILE__ ), array('jquery'), false, false);
}
// Include JS
function Alobaidi_Gallery_Include_JS(){
if( get_option('alobaidi_gallery_page') ){
$url = get_option('alobaidi_gallery_page');
$page_id = url_to_postid($url);
if( is_page($page_id) ){
Alobaidi_Gallery_JS();
}
}
else{
if( get_option('alobaidi_gallery_home') ){
Alobaidi_Gallery_JS();
}
}
}
add_action('wp_footer', 'Alobaidi_Gallery_Include_JS');
?>