Monthly Archives: December 2012

qtranslate and Magic Fields custom post menu link issue

When you add a custom post created with magic fields to a custom menu, it will not show up the language url like you want to when your using qtranslate. So how to fix it?

add this line to the qtranslate_hooks.php file in the plugin directory. Should be added at the bottom of the file. where similar hooks are there.

add_filter(‘post_type_link’, ‘qtrans_convertURL’);

Hope this helps.

Advertisements

How to get the upload folder in the theme files on WordPress

Ok a quick tip, How to get the upload folder in a theme file on WordPress.

Why we need this?

Well you might want to link to a pdf file or some static file from the theme file.

How to do this?

First get the upload folder into a variable,

<?php $upload_dir = wp_upload_dir(); ?>

Then use that variable in the url to get the path of the file,

<a href=”<?php echo $upload_dir[‘baseurl’]; ?>/Testfile.pdf”  target=”_blank”>Test link</a>

Simple as that.