Bantuan » Bantuan » Tema » [plugin] gimana cara nambah script di plugin

  • gan, ane mau tanya gimana caranya nambah script buat bikin file PDF ke plugins. tapi yang di print itu bukan yang dihalaman POST, tapi justru dihalaman admin.

    lalu script yang dijadikan PDF itu kaya gini gan.

    echo "<h2>PDF</h2>";
        global $wpdb;
        $ID = $_GET[ID];
    	$custom = get_post_custom($ID);
    	$custom["thumbs"] = isset($custom["thumbs"][0]) ? unserialize($custom["thumbs"][0]) : array();
       ?>
       <style type="text/css">
    		hr{ margin-right:17px;	}
       </style>
    	<form method="GET" action="../cari.php">
    	<input type="text" name="ID" placeholder="Masukkan ID"/>
    	<input type="hidden" name="jenis" value="SavePdf"/>
    	<a href="<?php echo WP_PLUGIN_URL . '/DB/coba.php?ID='.$ID; ?> ">Download</a>
    	<input type="Submit" value="pdf" />
        </form>
    	<hr />
    	<div id="show">
    	<div id="gambar" style="height:450px;">
    		<span style="float:left; margin-right:5px;">
    		<?php $i=0; ?>
    		<?php echo et_new_thumb_resize( et_multisite_thumbnail($custom["thumbs"][$i]), 457, 457 ); ?>
            <span class="overlay"></span>
            </span>
    
            <span style="border-left: black solid 2px; padding-left:5px; float:left; margin-right:5px;">
            <?php for ($i = 1; $i <= count($custom["thumbs"])-1; $i++) { ?>
    			<span class="small-controller<?php if($i==0) echo(' active'); if ($i==count($custom["thumbs"])-1) echo(' last') ?>" rel="<?php echo($i+1); ?>">
    			<?php echo et_new_thumb_resize( et_multisite_thumbnail($custom["thumbs"][$i]), 150, 150 );
    			?>
    			</span>
    		<?php
    		if($i % 3 == 0){
    			echo"</span><span style='margin-right:5px;'>";
    		}else{
    			echo"<br />";
    		}
    		 // habis
    		}; ?>
    		</span>
    	</div>
    	<br />
    	<div style="margin-top:-20px;">
    
    		<?php
    		//memunculkan keterangan gambar
    		global $wpdb;
    		$id_posting = $_GET[ID];
    		$query = "SELECT $wpdb->supple_hore.*, $wpdb->pilihanganda.value
    				  FROM $wpdb->supple_hore INNER JOIN $wpdb->pilihanganda
    				  ON $wpdb->supple_hore.post_id = $wpdb->pilihanganda.post_id
    				  WHERE $wpdb->supple_hore.post_id= $id_posting
    				  AND $wpdb->pilihanganda.katakunci='Status' LIMIT 0,1";
    		$hitung = "SELECT COUNT(*) FROM $wpdb->pilihanganda WHERE post_id = $id_posting AND katakunci='Status'";
    		$hasil = $wpdb->get_var($hitung);
    		$ron = $wpdb->get_results($query);
    		if($ron <> ''){
    			echo"<table>";
    			foreach($ron as $rons){
    				echo"<tr><td colspan='2'>";
    				if($hasil <> 2){
    					echo"<i><h1>".$rons->tipeproperty." ".$rons->value."</h1></i>";
    				}else{
    					echo"<i><h1>".$rons->tipeproperty." Dijual dan Disewakan</h1><i>";
    				}
    				echo"</td></tr>";
    				echo"<tr><td style='text-align:right; padding-right:7px; width:270px; border-right: solid 2px'>";
    				$marketing = $rons->marketing2;
    				if($marketing == ''){
    					echo "<h2 style='margin-top:10px;'>".$rons->alamat.", ".$rons->wilayah.", ".$rons->Kota."</h2><i><h3>Listed by ".$rons->marketing."</h3></i>";
    				}else{
    					echo "<h2 style='margin-top:10px;'>".$rons->alamat.", ".$rons->wilayah.", ".$rons->Kota."</h2><i><h3>Listed by ".$rons->marketing."&".$rons->marketing2."</h3></i>";
    				}
    				echo"</td><td><div>";
    				// oke asolole
    					$tipe = $rons->tipeproperty;
    					switch($tipe){
    						case "Rumah": // RUMAH
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    						$hadap = $rons->orientasi2;
    						if($hadap == ''){
    							echo "Orientasi hadap ".$rons->orientasi." <br/>";
    						}else{
    							echo "Orientasi hadap ".$rons->orientasi." & ".$rons->orientasi2." <br/>";
    						}
    							echo $rons->tingkat." Lantai, ".$rons->k_tidur." Kamar tidur, ".$rons->k_mandi." Kamar mandi <br/>";
    							$i=0;
    							$querys = "SELECT *
    							  FROM <code>$wpdb->pilihanganda</code>
    							  WHERE <code>post_id</code>= $id_posting
    							  AND <code>katakunci</code>='ruangan'
    							  ORDER BY 'id'";
    							$sql = $wpdb->get_results($querys);
    								if($sql <> ''){
    									foreach( $sql as $dataSql ){
    											echo $dataSql->value.", ";
    										$i++;
    										if($i % 3 == 0){
    											echo"<br/>";
    										}
    									}
    								}else{
    									echo"Ruangan Belum Tersedia";
    								}
    							echo"<br/>";
    							echo"Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->telpon." Line telpon <br/>".$rons->sertifikat."<br/>";
    
    						break;
    						case "Ruko": // RUKO
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    							echo $rons->tingkat." Lantai, ".$rons->k_tidur." Kamar tidur, ".$rons->k_mandi." Kamar mandi <br/>";
    							$i=0;
    							$querys = "SELECT *
    							  FROM <code>$wpdb->pilihanganda</code>
    							  WHERE <code>post_id</code>= $id_posting
    							  AND <code>katakunci</code>='ruangan'
    							  ORDER BY 'id'";
    							$sql = $wpdb->get_results($querys);
    								if($sql <> ''){
    									foreach( $sql as $dataSql ){
    											echo $dataSql->value.", ";
    										$i++;
    										if($i % 3 == 0){
    											echo"<br/>";
    										}
    									}
    								}else{
    									echo"Ruangan Belum Tersedia";
    								}
    							echo"Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->telpon." Line telpon <br/>".$rons->sertifikat."<br/>";
    						break;
    						case "Tanah": // TANAH
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    						$hadap = $rons->orientasi2;
    						if($hadap == ''){
    							echo "Orientasi hadap ".$rons->orientasi." <br/>";
    						}else{
    							echo "Orientasi hadap ".$rons->orientasi." & ".$rons->orientasi2." <br/>";
    						}
    							echo "Surat IMB ".$rons->imb."<br/>";
    							echo "Sertifikat ".$rons->sertifikat."<br/>";
    							echo "Harga permeter Rp.".number_format(esc_html($rons->harga_m2), 0, ',',',')."/m2<br/>";
    						break;
    						case "Stan": // STAN
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    							echo $rons->dimensi_LB." Kamar mandi<br/>";
    							echo"Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->sertifikat."<br/>";
    						break;
    						case "Pabrik": // PABRIK
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    							echo $rons->k_mandi." Kamar mandi <br/>";
    							echo "Surat IMB ".$rons->imb."<br/>";
    							echo "Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->telpon." Line telpon <br/>".$rons->sertifikat."<br/>";
    						break;
    						case "Kavling": //KAVLING
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Dimensi luas tanah ".$rons->dimensi_LT." m2<br/>";
    							echo"Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->sertifikat."<br/>";
    							echo "Harga permeter Rp.".number_format(esc_html($rons->harga_m2), 0, ',',',')."/m2<br/>";
    						break;
    						case "Gudang": //GUDANG
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Dimensi luas tanah ".$rons->dimensi_LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    							echo "Dimensi luas bangunan ".$rons->dimensi_LB." m2<br/>";
    							echo $rons->k_mandi." Kamar mandi, ";
    							echo "Listrik ".$rons->listrik." watt, Air ".$rons->air.", ".$rons->telpon." Line telpon <br/>".$rons->sertifikat."<br/>";
    							echo "Harga permeter Rp.".number_format(esc_html($rons->harga_m2), 0, ',',',')."/m2<br/>";
    						break;
    						case "Rumah Burung": //Rumah Burung
    							echo "Luas tanah ".$rons->LT." m2<br/>";
    							echo "Luas bangunan ".$rons->LB." m2<br/>";
    							echo "Dimensi luas bangunan ".$rons->dimensi_LB." m2<br/>";
    						default:
    						break;
    					} //akhir dari switch status
    					if($hasil <> 2){
    								$statusProperty = $rons->value;
    								if($statusProperty == "Dijual"){
    									echo"<h1>Harga Jual Rp.".number_format(esc_html($rons->harga_jual), 0, ',',',')." </h1>";
    								}else{
    									echo"<h1>Harga Sewa Rp.".number_format(esc_html($rons->harga_sewa), 0, ',',',')." </h1>";
    								}
    							}else{
    								echo"<h3> Harga Jual Rp.".number_format(esc_html($rons->harga_jual), 0, ',',',')."<br />
    								Harga Sewa Rp.".number_format(esc_html($rons->harga_sewa), 0, ',',',')."
    								<br/></h3>";
    							}
    				echo"</div></td></tr>";
    			}
    		}
    		?>
    	</div>
    	</div>

Melihat 1 balasan (dari total 1)
  • coba ini

    function contoh_tambah($content)
    {
    $content .= ‘ganti kalimat ini dengan yg kamu mau’;
    return $content;
    }

    add_filter(‘the_content’,’contoh_tambah’);

Melihat 1 balasan (dari total 1)
  • Topik ‘[plugin] gimana cara nambah script di plugin’ tertutup untuk balasan baru.