[sticky] [closed] WordPress Hacks (210 posts)

About This Topic

Tags

  1. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    send your articles by email to their friends

    < a href="mailto:?subject=<?php the_title(); ?>&body=<?php the_permalink() ?>" title="Send this article to a friend!">Email this< /a>

  2. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    Remove widget areas

    <?php add_filter( 'sidebars_widgets', 'disable_all_widgets' ); function disable_all_widgets( $sidebars_widgets ) { if ( is_home() ) $sidebars_widgets = array( false ); return $sidebars_widgets; } ?>

  3. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    provide tinyurls

    function getTinyUrl($url) { $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url); return $tinyurl; }

    <?php $turl = getTinyUrl(get_permalink($post->ID)); echo 'Tiny Url for this post: < a href="'.$turl.'">'.$turl.'< /a>' ?>

  4. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    Get parent page/post title

    <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>

  5. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    privates pages in navigation menus

    < ul>
    <?php wp_list_pages('depth=1&title_li=0&sort_column=menu_order'); if(current_user_can('read_private_pages')) : ?>
    < li>
    < a href="<?php echo get_permalink(10); ?>">For Authors only< /a>
    < /li>
    <?php endif; ?>
    < /ul>

  6. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    enlight searched text in search results

    echo $title;

    replaced with

    <?php $title = get_the_title(); $keys= explode(" ",$s); $title = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt">', $title); ?>

  7. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    Remove /category/ from your WordPress url

    RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]

  8. milo

    key master
    Joined: Dec '07
    Posts: 743


    Posted 3 months ago
    #

    Embed CSS in your posts with a custom field

    <?php if (is_single()) { $css = get_post_meta($post->ID, 'css', true); if (!empty($css)) { ?> <style type="text/css"> <?php echo $css; ?> <style> <?php } } ?>

    insert the following code between the <head> and </head>

Topic Closed

This topic has been closed to new replies.