Written in response to Redirect exit page: Get external url from custom field:
It seems to work now, but I had to change esc_url to esc_url_raw. Is it ok to use esc_url_raw instead?
Yes, it's fine to use
esc_url_raw in this case.
Another thing, this one needs javascript to work right? Is there another way to make the redirect not javascript dependent?
Yes, it can be made with a <meta> tag. Remove the JS redirection code and add this to
functions.php:
<?php
function custom_add_redirect_meta_tag() {
$exit_post_id = get_query_var( 'exit' ) ? get_query_var( 'exit' ) : 0;
$redirect_url = $exit_post_id ? get_post_meta( $exit_post_id, 'external_url_custom_field', true ) : '';
$timeout = '5'
if ( $redirect_url ) {
echo '<meta http-equiv="Refresh" content="' . $timeout . ';url=' . $redirect_url . '">';
}
}
add_action('wp_head', 'custom_add_redirect_meta_tag');
?>
link
Written in response to something Brennen Jones wrote.
Hi,
you can get pagination for image attachments, but it involves some code fiddling. It might be just easier to try this in you attachment.php:
<?php if ( wp_attachment_is_image( get_the_ID() ) ) echo do_shortcode( sprintf( '[gallery id="%1$s" exclude="%2$s" columns="8"]', $post->post_parent, get_the_ID() ) ); ?>
This loads a gallery of all the images attached to the same post, but excluding the current image. I think it's far better than having numbered links.
link
Written in response to Galleria Twelve theme enqueued properly but NAV not displayed:
How did you figure it out - what tool would you recommend and link to how to use it?
I used
Firebug for Firefox to inspect the nav elements and track down the CSS rules applied to them. I then tried opening the images, but there was an error with them.
You can use Chrome/Safari's developer tools or Opera's Dragonfly to inspect web-pages, if you're not working with Firefox.
link
Written in response to Why Attachment Page Defaults to Article Page?:
I really like this SEO plugin but now may have to find another alternative. I liked this one better than the All-in-One SEO pack.
I'd recommend sticking with WordPress SEO. It is quite comprehensive and the author is proficient in both SEO and WP. The plugin is actively developed and new options appear often. You might have overlooked that particular one regarding attachment pages.
link
Brennen Jones
had responses to this.
Written in response to Shortlinks for Custom Post Types:
Why not use a filter to apply the patch instead of hacking the core file? The function
wp_get_shortlink has a filter at the very top allowing for plugins to entirely overtake the functions output. So, try putting this in your
functions.php:
// Filter the default wp_get_shortlink
add_filter( 'pre_get_shortlink', 'filter_wp_get_shortlink', 10, 4 );
function filter_wp_get_shortlink( $shortlink = true, $id = 0, $context = 'post', $allow_slugs = true ) {
global $wp_query;
$post_id = 0;
if ( 'query' == $context && is_single() ) {
$post_id = $wp_query->get_queried_object_id();
} elseif ( 'post' == $context ) {
$post = get_post($id);
$post_id = $post->ID;
}
$shortlink = '';
// Return p= link for posts.
if ( !empty($post_id) && '' != get_option('permalink_structure') ) {
$post = get_post($post_id);
if ( isset($post->post_type) && 'post' == $post->post_type )
$shortlink = home_url('?p=' . $post->ID);
}
// Return p= link for all public post types.
if ( !empty($post_id) ) {
if (!isset($post)) {
$post = get_post($post_id);
}
$post_type = get_post_type_object( $post->post_type );
if ( $post_type->public ) {
$shortlink = home_url('?p=' . $post_id);
}
}
return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
}
link
Written in response to Move Publish MetaBox to Bottom:
This has to be placed before get_currentuserinfo(); or it won't work because that information is not available until pluggable.php is called.
It worked for me without calling that file. I'd recommend wrapping the code inside a function and calling it at the appropriate moment via an action hook. Something like:
function change_default_screen_layout () {
// paste all the code here
}
add_action( 'init', 'change_default_screen_layout' );
link