Tag Info

Hot answers tagged

9

To make a long story short: get_bloginfo( 'template_directory' ) and get_bloginfo( 'template_url' ) simply return get_template_directory_uri(). So, you can shortcut that second call simply by referring directly to the latter template tag. Refer to source for get_bloginfo(). A few others: 'url' => home_url() 'wpurl' => site_url() 'stylesheet_url' => ...


9

We have to look a bit deeper here to get an answer to your question. So, bloginfo is a simple wrapper around get_bloginfo. <?php function bloginfo( $show='' ) { echo get_bloginfo( $show, 'display' ); } Notice the second argument display. Let's see what that does. <?php function get_bloginfo( $show = '', $filter = 'raw' ) { // snip snip, ...


8

get_bloginfo('url') calls home_url() calls get_home_url() reads option home get_bloginfo('wpurl') calls site_url() calls get_site_url() reads option siteurl get_bloginfo('siteurl') and get_bloginfo('home') are deprecated arguments and return get_bloginfo('url') (siteurl argument is documented wrong in Codex as equal to wpurl, it's not in current code) The ...


4

While there is no inherent caching in get_bloginfo(), most of information it retrieves is from options and get_option() is cached. Holding value you need in a variable for using several time is still (marginally in most cases) faster than function call, but I wouldn't bother with explicit dedicated caching.


4

The difference in your case is in filters being applied to output of these functions. While bloginfo applies one of these filters: if ( 'display' == $filter ) { if ( $url ) $output = apply_filters('bloginfo_url', $output, $show); else $output = apply_filters('bloginfo', $output, $show); } Function home_url ...


4

The two functions output exactly the same thing. From the Codex entry for get_bloginfo(): 'name' - Returns the "Site Title" set in Settings > General. This data is retrieved from the "blogname" record in the wp_options table. From source: case 'name': default: $output = get_option('blogname'); Neither get_bloginfo() nor bloginfo() do any sort ...


4

bloginfo() is using echo, you need a function that returns its value: get_bloginfo(). In this case you could also use just the function get_bloginfo() is using: get_template_directory_uri().


3

You cannot use bloginfo() while your are outputting using echo because bloginfo it self also out puts string using echo. Below will work for you, you also have extra double quote which i have removed.... <?php $attch_id_1 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img1', true)); $image_attributes_1 = ...


3

get_stylesheet_directory_uri() returns a value, it doesn’t print anything. So you have to use: echo get_stylesheet_directory_uri(); get_template_part() is just a wrapper for locate_template(). But the latter has one advantage: It returns the path of the file it has found. Try the following: $path = locate_template( 'sidebar-front.php', TRUE ); echo ...


2

get_bloginfo returns strings so this works fine: <?php $language = get_bloginfo( 'language' ); if(language == 'en-US') the_time('jS F Y'); else the_time('d/m/Y'); ?>


2

Here's what I use: function oenology_copyright() { global $wpdb; $copyright_dates = $wpdb->get_results(" SELECT YEAR(min(post_date_gmt)) AS firstdate, YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts WHERE post_status = 'publish' "); $output = ''; ...


2

From 'wp-includes/general-template.php' function get_bloginfo( $show = '', $filter = 'raw' ) { switch( $show ) { case 'home' : // DEPRECATED case 'siteurl' : // DEPRECATED _deprecated_argument([snipped]); case 'url' : $output = home_url(); break; case 'wpurl' : $output = site_url(); break; ...


2

What you have: <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/style.css"> should work fine. I've copied and pasted into my header.php and it worked. But this is not how you should be including css or javascript files. The proper way is to use the wp_enqueue_scripts hook. For instance, say you have javascript ...


2

if ( get_bloginfo( 'description' ) ) { //do something } bloginfo echoes the description, get_bloginfo returns php variable


2

Ptriek's example checks if the value is true and unfortunately an empty value still evaluates to true, hence why it doesn't work as expected. Try the following instead.. <?php if( !empty( get_bloginfo('description') ) : ?> <!-- your html --> <?php endif; ?> NOTE: An empty check will also ring true for empty strings, so covers exactly ...


2

Open your backend and go to Settings/General. You will see to input fields: WordPress Address (URL) Site Address (URL) The first one correspond to site_url() and the second one to home_url() So why is there a difference? Because WordPress is able to start from a different site then your blog posts. For example, create a page called 'homepage' and enter ...


2

try this 'href'=> admin_url("post-new.php?post_type=albertis-kunstwerke")


1

Try these filters instead // changing the logo link from wordpress.org to your site function mb_login_url() { return home_url(); } add_filter( 'login_headerurl', 'mb_login_url' ); // changing the alt text on the logo to show your site name function mb_login_title() { return get_option( 'blogname' ); } add_filter( 'login_headertitle', 'mb_login_title' ); ...


1

Use Database Search and Replace and replace the IP 192.168.33.21 with the domain name project.dev.


1

You can access that, using the additional variable in the Filter Functions. The Filter bloginfo_url uses the $show parameter (the parameter you use when calling bloginfo) and passes it to apply_filters. So hooking into bloginfo_url should be no problem, you just have to make a switch inside the function, and it only applies to e.g. url . This would be the ...


1

Put this in your functions.php: function my_title() { if (is_home()) echo 'News'; else { global $post; if ($post->post_parent) echo get_post($post->post_parent)->post_title; else echo $post->post_title; } } // function my_title and then use <?php my_title(); ?> anywhere you want. ...


1

To avoid using deprecated call bloginfo('home') added new function to qtranslate_core.php: function qtrans_convertHomeURL($url, $what) { if($what=='/') return qtrans_convertURL($url); return $url; } and new filter to qtranslate_hooks.php: add_filter('home_url', 'qtrans_convertHomeURL', 10, 2); This way no other changes were needed. Not the best ...


1

You are using paths relative to the current directory. Try this (untested) echo "$i. <option value='" . home_url('/groundfish-meetings/' . $file) . "'>$file</option>";


1

First of all, bloginfo will output value ;) If you want to get the value, you should use get_bloginfo. get_bloginfo takes one param from predefined set (You can find all possible values here: http://codex.wordpress.org/Function_Reference/bloginfo). Only part of these values are values of options (in such case bloginfo returns value of that option). ...


1

Try using get_bloginfo() instead of bloginfo(). The former returns the value; the latter echoes the value.


1

The error indicates that your file "floater.php" is being called outside of a WordPress generated page. Add this to the top of the file to be able to use WordPress functions. EDIT: See Brian Fegter response on using the server path for your include. if ( !function_exists( 'get_bloginfo' ) ) require( '../../../wp-blog-header.php' ); // check path leads ...


1

You should include using the server path rather than the URL. This will give you access to WordPress functionality. include('extras/floater.php'); Update: The following is to further explain why it's a bad practice to include the file via URL. Here's what's happening: There is an innate inheritance when you include a file via server path. It has access ...


1

I’ve written a plugin that replaces the Biographical Info profile field with the WordPress visual editor, TinyMCE, allowing you to editor an author’s biography using rich text using a new function, wp_editor(), that was released with WordPress 3.3. http://wordpress.org/extend/plugins/visual-biography-editor/ Using this plugin will ensure that the editor ...


1

First thing I noticed is that your secondary pages link to images using a URL like: http://www.bowlingventures.com/BVc_13/wp-content/themes/bowlingventures/images/m2u.jpg whereas your home page uses: http://www.bowlingventures.com/wp-content/themes/bowlingventures/images/m2u.jpg Not sure this helps, but perhaps this will help someone else figure out what ...


1

you are storing the value into a variable you need to use get_bloginfo('url') http://codex.wordpress.org/Function_Reference/get_bloginfo



Only top voted, non community-wiki answers of a minimum length are eligible