Daniy Image Manager Plugin Saves Your WordPress Queries for Attachments

Blogging with lots of images on each post is surely a repetitive task where in some time will burn you out. The task for opening and inserting images to the post is a boring task. For you who have a few WordPress coding skills, you can write a piece of code to call for the current post attachments and output it to the browser. I have this piece of code, once referred by Isnaini from a website which is now currently available. With a function called the_image(), any number of images attached to a post will be automatically listed along with the single page view.

Post Attachments GalleryPost Thumbnail Screenshot

One thing I found later, that it costs a bit of WordPress queries to call each those attachments off the database. Getting attachments with get_posts() function is one query, extracting its size and file location is another call to wp_postmeta where all data about an attachment is stored. So if you have 20 images in a post, you’ll end up with additional 21 queries. More queries means more load time for your server to response a request from browser. Bad.

So, now I improved those snippet so that every request to attachment in database will be only fired up once, and then cached silently into WordPress main posts table, the wp_posts table. This table and the corresponding table row is ALWAYS called everytime a post is requested, which means we don’t need to make additional queries just to get post attachments.

Now, here’s the plugin… Download from the WordPress.org repository

http://wordpress.org/plugins/daniy-image-manager/

Once you download, upload and install it on your WordPress, go to the text editor and put this single line of function in single.php right after <?php the_content(); ?> tag, to get ALL the post attachments

<?php imwp_view_gallery(); ?>

And in your archive.php, or category.php, put this function in a WordPress Loop to call the post thumbnail

<?php imwp_view_thumbnail(); ?>
WordPress Tips: Menambahkan User Baru Lewat phpMyAdmin

Punya blog WordPress banyak (banget)? Saking banyaknya, sampai-sampai kamu lupa username dan password salah satu website? Asalkan kamu punya akses ke database via phpMyAdmin, kamu bisa reset password dengan beberapa langkah mudah.

Pertama, jelas sekali kamu harus login ke phpMyAdmin. Lalu pilih salah satu database WordPress yang ingin kamu ganti password-nya.

Pilih tabel wp_users, lalu klik ikon pensil di sebelah kiri username yg akan diganti password-nya. Di kotak dialog baru, hapus nilai field “user_pass” lalu ganti dengan password barumu. Kamu juga HARUS GANTI nilai dropdown function di samping “user_pass” dgn MD5.

WordPress Change Password via Phpmyadmin

Ada lagi lanjutannya, loh..

WordPress Code: Menambahkan Loop Random pada Halaman Archive

Halaman Archive pada WordPress adalah termasuk halaman Category, Tags, Monthly Archive, Yearly Archive, dan Author. Menurut pengamatan mas Jarot Syahputro, biasanya halaman Archive Yearly, Monthly, serta Latest Posts sangat berpotensi menampilkan posting yang sama dengan urutan yang sama. Ini bisa mengundang penilaian duplicate content oleh Google.

Salah satu cara agar halaman-halaman tersebut bisa berbeda satu dengan yang lain, maka langkah-langkah randomisasi bisa dijadikan sebuah teknik untuk menghindari internal duplicate pages pada web yang bemesin WordPress.

Berdasarkan ide beliau tersebut , maka berikut langsung saja saya jabarkan kodenya untuk segera bisa diimplementasikan.

Sebagai pembuka, marilah kita bersama-sama mengenali, bagian mana sih yang disebut sebagai WordPress Loop itu? Jika, Anda punya waktu luang dan mata yang sehat untuk melihat, maka segerelah buka template Anda, lalu bukalah salah satu file misalnya archive.php atau category.php

Cobalah cari potongan kode berikut:






Nah, itulah yang namanya WordPress Loop. Beberapa template tidak menyertakan <?php if(have_posts()) ?> dan <?php endif; ?>, sehingga Loop ditutup pada tag <?php endwhile; ?>

Kode berikut ditambahkan pada baris baru setelah WordPress Loop yang normal

 'rand', 'showposts' => 5)); ?>


Perlu diperhatikan bahwa tag HTML yang tertulis di atas harus disesuaikan dengan tag HTML yang ada pada masing-masing template WordPress. Yang harus sama adalah bagian

 'rand', 'showposts' => 5)); ?>

dan


	

Untuk nilai showposts bisa disesuaikan selera. Di atas tertulis ‘showposts’=>5, berarti loop tersebut akan menampilkan jumlah posts sebanyak 5 buah.

Selamat mencoba…

WORKS