Archive for the ‘wordpress tutorial’ Category

Tumblr API for WordPress

there are a few assumptions:

  1. you already have your tumblr consumer key, secret, oauth token, and oauth token secret
  2. i used this tutorial as a starting point:
    • i didn’t use the callback.php nor the connect.php files in the zip
  3. create a private (password-protected) tumblr blog and set up each editor as a contributor to it
    • private because you don’t want viewers to happen upon the tumblr site (you’ll lose hits on your own site!)

Read the rest of this entry »

Get the ID of a Post Meta Image

I Google’d and checked the WordPress codex, but could not find a function that would give me the ID of an image I uploaded into a custom meta field.

The Problem

I have uploaded an image, but that image is huge. I want to be able to display the image at my predefined size. There are functions to display the post thumbnail (featured image) in any which way you want, but this is different.

This is the cleanest method I’ve found to get the attachment’s ID. With the ID, you’ll be able to use a function to display that image.
Read the rest of this entry »

qTranslate: Issues with Duplicate Content?

so i’ve been using this wordpress plugin that will help your site become multilingual called qTranslate. it’s awesome. it allows you to add different translations for menus, posts, pages, widgets, etc with a little bit of effort (of course, every project is different, some php coding may be required). here’s a fairly quick startup guide

the thing is, we only need the plugin for a set of pages and that’s it… not the most ideal solution, but it’s working… or was

i found a random issue that no amount of googling could resolve… every page that didn’t require translation would display fine except for the below snippet of code

essentially, the code was using “get_posts” to display a page within a page (almost inception-like)

Read the rest of this entry »

WordPress: Media Uploader for Meta Boxes

so i’ve been running into a nagging issue with wordpress’ new instance of its media uploader (released in v3.5)

if i had a meta box with an image uploader, it would conflict with the standard “Add Media” button for the editor

previous code


jQuery(document).ready(function() {
var form_field;
jQuery('.button-upload').click(function() {
form_field = '#' + jQuery(this).next('input').attr('id');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;

window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
imgurl = jQuery(html).attr('src');
if (jQuery(form_field).length > 0) {

Read the rest of this entry »

Custom Metabox Per Template

so this came about when i was tasked to create a custom metabox for a wordpress site at work. i didn’t want the metabox to appear unless a specific template was chosen — this is so as not to confuse the person in the admin with new options they shouldn’t be messing with.

i found this solution, but it wasn’t quite working in my admin. so i put on my wordpress/php developer cap and dissected it down to the following:

Read the rest of this entry »