Skip to main content

Tech Help

  • Latest Posts
  • Tools
  • Tutorials
  • Troubleshooting
  • Random Number

Tag: code snippet

Display specific post in WordPress

December 27, 2011January 4, 2012 contrib Leave a comment

To display a specific post by post ID, add the following code to your WordPress template file. <?php //Select specific post ID $post_id=256; //To display post title echo ‘<h1>’ . get_post($post_id)->post_title . ‘</h1>’; //To display post content echo get_post($post_id)->post_content; ?> Tested with WordPress 3.3

Read More

HTML Code to Text Converter

December 25, 2011December 25, 2011 contrib Leave a comment

Useful for converting code for presentation on a WordPress post. Converts tags so they are not processed. Good for displaying blocks of code for tutorials etc.. This version seems the best I have found for WordPress. WEBSITE

Read More

Wrapping pre tag text in a div using css

December 17, 2011January 4, 2012 contrib Leave a comment

When using pre tags in html to display code blocks it will ignore the div boundaries and not wrap the text by default. By adding some css for pre tags this can be accomplished as follows. Hint: Another option is to use overflow:auto which will add scroll bars for the content. pre, code{ /*Wrap pre […]

Read More

Add a Read More link to the_excerpt() in WordPress

December 17, 2011January 4, 2012 contrib Leave a comment

To remove the default […] marker at the end of an excerpt and add a Read More link add the following code to your theme’s functions.php file function new_excerpt_more($more) { global $post; return '<a href="'. get_permalink($post->ID) . '"> Read More…</a>'; } add_filter('excerpt_more', 'new_excerpt_more'); Tested with WordPress version 3.3

Read More

Redirect WordPress login logo link

December 16, 2011January 4, 2012 contrib Leave a comment

If you want your wordpress login logo to redirect to your site root add the following code to your theme’s functions.php file add_filter('login_headerurl', 'my_login_url_local'); function my_login_url_local() { return get_bloginfo('url'); } Tested with WordPress 3.3

Read More

Change WordPress login logo

December 16, 2011January 4, 2012 contrib Leave a comment

If you want to change the default wordpress logo on the login page, you can add the following code to your themes functions.php file. Make sure /images/login-logo.png is present in your theme folder. function custom_login_logo() { echo '<style type="text/css">h1 a { background-image:url('.get_bloginfo('template_url').'/images/login-logo.png) !important; }</style>'; } add_action('login_head', 'custom_login_logo'); tested with wordpress version 3.3  

Read More

Posts pagination

Newer posts 1 2 3

Search

Fields

Tags

apache apple audio benchmarking code snippet cpu CSS diagnostic disaster recovery docker download dvd excel exe files graphics HDD html Intune ipad linux media MSI music MySql overclocking path php powershell proxy RDP remote access remote support security ssh stress testing testing tutorials ubuntu video wamp windows wordpress workspace one wsl

Recent Posts

  • Check PHP-FPM Running Versions
  • Windows Desktop Icons Are White
  • WSL Ubuntu Reclaim Space on Vdisk Image Using Diskpart in Windows
  • Docker Import Mysql Database
  • Redis Viewer Tableplus

Other Pages

  • Privacy Policy
  • Terms and Conditions
sparkling Theme by Colorlib Powered by WordPress