Tag Info

Hot answers tagged

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 ...


5

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' => ...


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 ...


3

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 ...


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

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

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 ...


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

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

Use get_stylesheet_directory_uri() and get_template_directory_uri() instead. Note that these functions return rather than echo their result. So, for example: <img src="<?php echo get_template_directory_uri();?>/images/Lynx.gif" alt="castandtubular"/>


1

If your style.css is in /wp-content/themes/themedirectory, and your image is at /wp-content/themes/themedirectory/images/image.jpg, then your css will be this: background-image: url("images/image.jpg"); You can't use php in a css file, it will not parse unless included via php (instead of with <link>).


1

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; ...


1

You can't check the context while the filter callback is called, because the element is already in the frontend. There are 3 solutions though: 1. jQuery Search for the element and add html to the places in the name. 2. PHP in element Get the bloginfo('name'); in the element and change it on that place using PHP. 3. PHP in header Add HTML to your ...


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

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

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


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 ...



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