• 25-07-2014, 23:43:15
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    merhaba değerli webmaster arkadaşlar elimde bir HABER TEMASI var ve ben bu temayı geliştirmeye çalışıyorum ama temanın bileşenine gazete kodu eklemeye çalışıyorum hata veriyor bana bu kodu eklememde yardımcı olurmusunuz bilişen kodu budur
    <?php
    ######################################################################################
    # YanPopulerHaberler
    ######################################################################################
    
    class YanPopulerHaberler extends WP_Widget {
    
        function __construct() {
            $widget_options = array( 'description' => 'Yan menu için popüler haberler' );
            parent::WP_Widget(false,'(Yan) Popüler Haberler', $widget_options );
        }
         
        function widget($args, $instance) {
    		extract($args);
    		$sayi = $instance['sayi'];
    		$tip = $instance['tip'];
    	
    		
    		if(empty($sayi)) {
    			$sayi = "4";
    		}
    		if(empty($tip)) {
    			$tip = "tip1";
    		}		
    		echo $before_widget;
    
            ?>
    		
    		<div class="yan-haber-blok bilesen populer-haberler">
    			<div class="bilesen-baslik">
    				<h2 class="sol">
    					<i class="icon-star"></i>
    					Popüler Haberler
    				</h2>
    			</div>
    			<div class="ic">
    			<?php
    			query_posts("cat={$kategori}&showposts={$sayi}&v_sortby=views");
    			while ( have_posts() ) : the_post();
    			global $post;
    			?>
    				<?php if($tip == "tip1") { ?>
    				<div class="t tip1">
    					<a class="sol" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    						<?php wptr_portal_resim($post->ID,"boyut140x110"); ?>
    					</a>
    					<h3 class="sag">
    						<a title="<?php the_title(); ?>"href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    					</h3>
    				</div>
    				<?php } elseif($tip == "tip2") { ?>
    				<div class="t tip2">
    					<a class="db" title="<?php the_title(); ?>"href="<?php the_permalink(); ?>">
    						<span class="db to"><?php the_title(); ?></span>
    						<?php wptr_portal_resim($post->ID); ?>
    					</a>
    				</div>				
    				<?php } else { ?>
    				<div class="t tip0">
    					<a class="sol" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    						<?php wptr_portal_resim($post->ID,"boyut110x70"); ?>
    					</a>
    					<h3 class="sag">
    						<a title="<?php the_title(); ?>"href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    					
    						<span class="tarih db"><?php wptr_portal_tarih(strtotime($post->post_date_gmt), $post->post_date); ?></span>
    					</h3>
    				</div>				
    				<?php } ?>
    			<?php
    			endwhile;
    			wp_reset_query();
    			?>		
    			</div>		
    		</div><!--/haber-blok-->
    
    
    		
            <?php
            echo $after_widget;
            
    		}
        
    		function update($new_instance, $old_instance) {
    			return $new_instance;
    		}
        
    		function form($instance) {
    
    
            if(isset($instance['sayi'])) {
                $sayi = $instance['sayi'];
            }							
            if(isset($instance['tip'])) {
                $tip = $instance['tip'];
            }		
            ?>
    		
            <p>
                <label for="<?php echo $this->get_field_id( 'sayi' ) ;?>">Kaç adet haber görünsün:</label>
                <input 
    				type="text" id="<?php echo $this->get_field_id( 'sayi' ) ;?>"
                    class="widefat" value="<?php echo $sayi; ?>" name="<?php echo $this->get_field_name( 'sayi' ) ;?>" 
    				
    			/>
            </p>
            <p>
                <div><label for="<?php echo $this->get_field_id( 'tip' ) ;?>">Listeleme tipi:</label></div>
                <select name="<?php echo $this->get_field_name( 'tip' ) ;?>" id="<?php echo $this->get_field_id( 'tip' ) ;?>">
    				<option value="tip0" <?php selected( $tip, "tip0" ); ?>>Tip 0(resimler çok küçük)</option>
    				<option value="tip1" <?php selected( $tip, "tip1" ); ?>>Tip 1(resimler küçük)</option>
    				<option value="tip2" <?php selected( $tip, "tip2" ); ?>>Tip 2(resimler büyük)</option>
    			</select>
            </p>
    		<?php if(!function_exists('the_views')) {?>
    		<p style="color:red">
    			Popüler haberleri listeleyebilmek için WP-Postviews eklentisinin sitenizde kurulu olması lazım!
    		</p>
    		<?php } ?>
    <?php
        }
    }
    register_widget( 'YanPopulerHaberler' );
    benim bilişene eklemek istediğim kodda budur
    <div style="width: 300px; height: 225px; overflow: hidden;"><iframe width="300" height="225" src="http://www.butungazetemansetleri.com/gazeteler-kodu.php" frameborder="0" scrolling="no"></iframe>
    <br /><a href="http://www.butungazetemansetleri.com/" title="Gazete Manşetleri">Gazete Manşetleri</a></div>
    bu kodu yokarıda vermiş olduğum php bilişen koduna eklermisiniz size zahmet birde konu yanlış yerdeyse lutfen moderatör tarafından doğru yere taşına bilirm teşekkürler..
  • 26-07-2014, 10:58:46
    #2
    şu şekilde denermisin hocam;

    class GazeteBilesen extends WP_Widget {
    
    	function __construct() {
    		parent::__construct(
    			'gazete_bilesen',
    			'Gazete Bileşeni',
    			array( 'description' => 'Yan bölüm için Gazete bileşeni.' )
    		);
    	}
    
    	public function widget( $args, $instance ) {
    		$title = apply_filters( 'widget_title', $instance['title'] );
    
    		echo $args['before_widget'];
    		if ( ! empty( $title ) ) {
    			echo $args['before_title'] . $title . $args['after_title'];
    		}
    		?>
    		<!-- Gazete iframe kodu -->
    		<div style="width: 300px; height: 225px; overflow: hidden;"><iframe width="300" height="225" src="http://www.butungazetemansetleri.com/gazeteler-kodu.php" frameborder="0" scrolling="no"></iframe> 
    		<br /><a href="http://www.butungazetemansetleri.com/" title="Gazete Manşetleri">Gazete Manşetleri</a></div>  
    		<!--# Gazete iframe kodu -->
    		<?php echo $args['after_widget'];
    	}
    
    	public function form( $instance ) {
    		if ( isset( $instance[ 'title' ] ) ) {
    			$title = $instance[ 'title' ];
    		}else{
    			$title = 'Gazete';
    		}
    		?>
    		<p>
    		<label for="<?php echo $this->get_field_id( 'title' ); ?>">Başlık</label> 
    		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
    		</p>
    		<?php 
    	}
    
    	public function update( $new_instance, $old_instance ) {
    		$instance = array();
    		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
    
    		return $instance;
    	}
    
    }
    
    add_action('widgets_init', function(){
    	register_widget('GazeteBilesen');
    });
  • 26-07-2014, 20:45:57
    #3
    Üyeliği durduruldu
    jebias adlı üyeden alıntı: mesajı görüntüle
    şu şekilde denermisin hocam;

    class GazeteBilesen extends WP_Widget {
    
    	function __construct() {
    		parent::__construct(
    			'gazete_bilesen',
    			'Gazete Bileşeni',
    			array( 'description' => 'Yan bölüm için Gazete bileşeni.' )
    		);
    	}
    
    	public function widget( $args, $instance ) {
    		$title = apply_filters( 'widget_title', $instance['title'] );
    
    		echo $args['before_widget'];
    		if ( ! empty( $title ) ) {
    			echo $args['before_title'] . $title . $args['after_title'];
    		}
    		?>
    		<!-- Gazete iframe kodu -->
    		<div style="width: 300px; height: 225px; overflow: hidden;"><iframe width="300" height="225" src="http://www.butungazetemansetleri.com/gazeteler-kodu.php" frameborder="0" scrolling="no"></iframe> 
    		<br /><a href="http://www.butungazetemansetleri.com/" title="Gazete Manşetleri">Gazete Manşetleri</a></div>  
    		<!--# Gazete iframe kodu -->
    		<?php echo $args['after_widget'];
    	}
    
    	public function form( $instance ) {
    		if ( isset( $instance[ 'title' ] ) ) {
    			$title = $instance[ 'title' ];
    		}else{
    			$title = 'Gazete';
    		}
    		?>
    		<p>
    		<label for="<?php echo $this->get_field_id( 'title' ); ?>">Başlık</label> 
    		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
    		</p>
    		<?php 
    	}
    
    	public function update( $new_instance, $old_instance ) {
    		$instance = array();
    		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
    
    		return $instance;
    	}
    
    }
    
    add_action('widgets_init', function(){
    	register_widget('GazeteBilesen');
    });
    direk kopyala yapıştır yaptım bu hatayı verdi hocam
    Parse error: syntax error, unexpected '}' in /home/corum/public_html/tema/wp-content/themes/habertemam/lib/bilesenler/yan/gazeteler.php on line 24
  • 26-07-2014, 20:49:13
    #4
    Temaya bileşen desteği mi eklemek istiyorsunuz anlamadım?
  • 26-07-2014, 21:09:53
    #5
    Üyeliği durduruldu
    SeliM adlı üyeden alıntı: mesajı görüntüle
    Temaya bileşen desteği mi eklemek istiyorsunuz anlamadım?
    evet hocam yokarıda bileşen kodunu ve bileşene eklemek istediğim türden 1 kod verdim ona göre yani o kod bileşenine göre
  • 27-07-2014, 19:30:01
    #6
    Üyeliği durduruldu
    Konu Günceldir