Related posts for a post

Or, you can place this code in your active theme’s functions.php: <?php // First, backup the default $postdata $backup = $post; // Now, override the default $tags = wp_get_post_tags($post->ID); // Now, open the if ( $tags ) statement if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; // Now, setup your custom … Read more

Link to older links

Ok then… try this (hope i got your request right): REVISED <?php get_header(); query_posts( array( ‘posts_per_page’ => 5, ‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1 ), )); // The Loop if (have_posts()){ while (have_posts()){ //Iterate the cursor on the next post the_post(); echo “<a class=”more-link” href=””; the_permalink(); echo “”><h1>”; the_title(); echo “</h1></a>”; echo “<div … Read more

Image not showing up in media loader success area – followup

untested, but it should work theoretically: add_filter(‘get_attached_file’, function($path, $file, $attachment_id){ // get the post object of the current attachment $att = get_post($attachment_id); // prepend attachment post parent ID to the file name return substr_replace($path, “{$att->post_parent}/{$file}”, -strlen($file)); }); Another filter, attempts to “fix” the path returned by WP’s upload handler: add_filter(‘wp_handle_upload’, function($results){ global $post; if(empty($post)) return … Read more

custom menu widget where menu title is a link

You can filter the title of most widgets and change the markup. The name of the filter is ‘widget_title’ and the third parameter tells you the type of the filtered widget. Sample code, not tested: add_filter( ‘widget_title’, ‘wpse_52108_nav_widget_title_link’, 30, 3 ); /** * Changes the title for the nav menu widget. * * @param string … Read more

How do i remove all Bit.ly shortened links from site?

This can be solved by making SQL queries directly in the database. But this only works easily for replacing the URL of a link, not the whole link markup. Replacing all bit.ly links with their original long URL would be the best way to solve the blacklist problem. This is the query you would do, … Read more

How to get Facebook to see YouTube/Blip embeds when sharing a link?

All in One SEO plugin is setting your FaceBook open graph meta tags. For Facebook to “see” your video, you need to set video meta tags: <meta property=”og:video” content=”http://example.com/movie.swf” /> <meta property=”og:video:secure_url” content=”https://secure.example.com/movie.swf” /> <meta property=”og:video:type” content=”application/x-shockwave-flash” /> <meta property=”og:video:width” content=”400″ /> <meta property=”og:video:height” content=”300″ /> Whether or not this is possible with that plugin … Read more

Modify links in user comments

To replace nofollow with nofollow external _blank Put this code in your theme’s functions.php file to replace text as required. function wpse_60668_relnofollow($text) { $return = str_replace(‘nofollow’, ‘external nofollow _blank’, $text); return $return; } add_filter(‘get_comment_author_link’, ‘wpse_60668_relnofollow’); //this’ll change author link add_filter(‘comment_text’, ‘wpse_60668_relnofollow’); //This’ll change the content

Display custom field value as a mailto: link

well you did all the hard stuff, so you can try this: while ( $loop->have_posts() ) : $loop->the_post(); $mail = get_post_meta($post->ID, ‘mail’, true); if ($mail) { echo ‘<a href=”https://wordpress.stackexchange.com/questions/60953/mailto:”.$mail.'”>email me at ‘.$mail.'</a>’; } /* … */

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)