Wordpress Resim Galeri içine Reklam Koymak İsitiyorum.
Mesela 1-2-3-4-5reklam-6-7-reklam-8-reklam- gibi resim galeri aralarına reklam koymak için tasarlanmış galeri eklentisi mevcut mudur?
Wordpress Resim Galeri içine Reklam Eklentisi Yardım |
6 Mesajlar | 2.998 Okunma |
Eklentisiz bunu yapabilirsin. Yazına eklediğin resimlerin arasına <--!nextpage--> koyarak resimleri sayfalıyorsun. Örnek;
<--!nextpage-->
<--!nextpage-->
reklam kodu <--!nextpage-->
<--!nextpage-->
<--!nextpage-->
Bu kadar basit.
/*
Plugin Name: Ozel Gallery
Plugin URI: http://www.heyjohnsexton.com/projects/
Description: Instantly creates a simple image gallery from any images uploaded to a post or page
Author: John Sexton
Version: 1.0
Author URI: http://www.heyjohnsexton.com
*/
/* Copyright 2012 John Sexton (email : heyjohnsexton@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//----------------------------------------------------------------------
// Import Stylesheet
//----------------------------------------------------------------------
function add_stylesheets() {
// change this path to load your own custom stylesheet
$css_path = WP_PLUGIN_URL . '/ozel-gallery/ozel-gallery.css';
// registers your stylesheet
wp_register_style( 'ozelGalleryStyles', $css_path );
// loads your stylesheet
wp_enqueue_style( 'ozelGalleryStyles' );
}
// Only add the stylesheet if we are NOT on the admin screen
if (!is_admin()) add_action( 'wp_enqueue_scripts', 'add_stylesheets' );
//---------------------------------------------------------------------------------------
// Enqueue jQuery from Google
//---------------------------------------------------------------------------------------
function enqueue_jquery() {
wp_enqueue_script('jquery');
}
// Only add the javascript if we are NOT on the admin screen
add_action("wp_enqueue_scripts", "enqueue_jquery", 11);
//-------------------------------------------------
// Activate Instant Gallery
//-------------------------------------------------
function activate_ozel_gallery(){
?>
<script>
// Wrap the jQuery code in the generic function to allow use of
// the $ shortcut in WordPress's no-conflict jQuery environment
( function ($) {
$('#og-thumbs').delegate('img','click', function(){ // When someone clicks on a thumbnail
$('#og-hero').attr('src',$(this).attr('src').replace('-150x150','')); // Replace the Full Sized version of selected image
$('#og-thumbs li img').removeClass("selected"); // Remove "selected" class from all thumbnails
$(this).addClass("selected"); // Add "selected" class to selected thumnail
$('#og-title').html($(this).attr('alt')); // Replace the Title with Title of selected image
});
// Preload all other images in the slideshow so we don't have to wait
// when we click on them. This also helps avoid awkward transitions
// when the description for the new image loads before the new image itself
})(jQuery);
</script>
}
// Hook into footer so gallery becomes active after page loads
add_action('wp_footer','activate_ozel_gallery');
//-------------------------------------------------------------
// Instant Image Gallery by John Sexton
//-------------------------------------------------------------
function ozel_gallery() {
global $post;
$args = array(
'post_parent' => $post->ID, // For the current post
'post_type' => 'attachment', // Get all post attachments
'post_mime_type' => 'image', // Only grab images
'order' => 'ASC', // List in ascending order
'orderby' => 'menu_order', // List them in their menu order
'numberposts' => -1, // Show all attachments
'post_status' => null, // For any post status
);
// Retrieve the items that match our query; in this case, images attached to the current post.
$attachments = get_posts($args);
// If any images are attached to the current post, do the following:
if ($attachments) {
// Initialize a counter so we can keep track of which image we are on.
$count = 0;
// Now we loop through all of the images that we found
foreach ($attachments as $attachment) {
// Below here are the main containers and first large image; stuff we will only want to output one time.
if($count == 0) { ?>
'id' => "og-hero",
'alt' => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )),
'title' => trim(strip_tags( $attachment->post_title )),
);
?>
ID, 'full', false, $default_attr); ?>
post_title; ?>
-
// If this is the first thumbnail, add a class of 'selected' to it so it will be highlighted
$thumb_attr = array(
'class' => "thumb selected",
);
} else {
// For all other thumbnails, just add the basic class of 'thumb'
$thumb_attr = array(
'class' => "thumb",
);
} ?>
ID, 'thumbnail', false, $thumb_attr); ?>
}
// Create the Shortcode
add_shortcode('ozel_gallery', 'ozel_gallery');
?>