Shortcode won’t execute

You’re using your shortcode function to directly output something (using echo). Shortcodes are supposed to return the desired output rather than echo it directly. You could use output buffering to “catch” anything that’s outputted (for example, via echo) in an output buffer instead of directly outputting it, and retrieve the content of the buffer afterwards. … Read more

WordPress loop is not working

custom-header.php <!– Start Top Header affix nav–> <div id=”affix” data-spy=”affix” data-offset-top=”94″ data-offset-bottom=”0″> <!– **** START – NAVBAR SCROLLSPY FIX DO NOT REMOVE **** –> <div id=”top” class=”hide”></div> <!– **** END – NAVBAR SCROLLSPY FIX DO NOT REMOVE **** –> <!– **** START – NAV **** –> <nav class=”navbar navbar-default navbar-shrink”> <div class=”container”> <div class=”navbar-header”> <!– … Read more

Replace Post-Title with variable

For hiding Title in admin panel the easiest way is using CSS. Another better way is using front-end submitting plugins. Follwoing code help you to change post title. add_filter( ‘the_title’, ‘replacePostTitle’, 100, 2); function replacePostTitle($title, $id){ if (is_feed()) $return $title; //do some magic here return $new_title; }

Shortcode for a Series of Elevating Image Files, Excluding a Range?

You can try the following code snippet: /** * Shortcode for a series of elevating image files, excluding a range * * @link http://wordpress.stackexchange.com/a/151408/26350 */ add_shortcode( ‘episode’, ‘episode_shortcode’ ); function episode_shortcode( $atts = array(), $content=”” ) { //———————– // Settings: // $path=”/path/to/files”; $ext=”jpg”; //———————– // Shortcode input: $atts = shortcode_atts( array( ‘num’ => 0, ‘title’ … Read more

Setting a default thumbnail url if no thumbnail

Just set up a condition to check that thumb_id isn’t empty. If it is, use your alternative image. Pretty simple stuff. <?php $thumb_id = get_post_thumbnail_id(); if ( $thumb_id ) { $thumb_url = wp_get_attachment_image_src($thumb_id,’thumbnail’, false); $thumb_url = $thumb_url[0]; } else { $thumb_url=”http://www.website.com/img/default.jpg”; } ?> <div class=”content” style=”background-image:url(<?php echo $thumb_url; ?>);”>

wordpress admin part is not accesbile after server shifting

There are following possibilities when you cann’t open wp-admin 1.There should be some file missing 2.Some function deny to login in themes files 3.Some plugin may also create issue Solution:- 1.Replace all files from new WordPress except wp-content and wp-config file 1. Rename your theme folder in wp-content 2. Rename Plugins folder in wp-content Hope … Read more

WordPress Staging and Testing of Plugins Best Practices

I don’t think there is the one correct answer. We use Git to manage versions. We have the master branch, that syncs with an online staging server, that has it’s own database. (Using the live database is kinda too hot for my taste.) Then there is the stable branch, that syncs with the live server. … Read more

How to get the slug of the homepage when editing it in WP admin?

post_name would be the slug as it was set before the page became the front page. When the URL for the front page is output via the API, the get_page_link function checks if the ID matches the page_on_front option and returns the home_url in that case. This is why you should always use the API … Read more