Articles of php

Is Auto Post recognition a WordPress feature? How to turn it off?

I noticed that if you go to lostlettermen.com/aa, it redirects to a post. Is this a feature in WordPress that can be turned off, or is this done by some type of plugin or custom code?

WordPress override bloginfo variable

How would I override a bloginfo variable in wordpress? For example, I want to replace this: <?php bloginfo(‘stylesheet_directory’); ?> to return a custom URL like http://mysites.com/hello/

Custom excerpt function re-factoring

This may be more of a php best practices question, but here goes… I am using a custom excerpt trim function: function new_wp_trim_excerpt($text) { // Fakes an excerpt if needed global $post; if ( ” == $text ) { $text = get_the_content(”); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]&gt;’, $text); $text = strip_tags($text, ‘<p>’); […]

How do I implement a .diff changeset from core.trac.wordpress.org locally?

I have a local copy of the latest version of wordpress that I set up using svn co http://core.svn.wordpress.org/trunk/ There is a diff that I want to pull into my local fileset: http://core.trac.wordpress.org/attachment/ticket/19371/19371.diff Is this something that I can do with subversion? What commands do I need to use?

Where would I place `wp_footer();`?

I am currently working on the footer.php file. I am just wondering where I should place the wp_footer(); in relation to the <footer> elements. Which of the following would be correct? Method A: <footer> <h1>Title Text</h1> <p>Some text</p> <?php wp_footer(); ?> </footer> </body> </html> Method B <footer> <h1>Title Text</h1> <p>Some text</p> </footer> <?php wp_footer(); ?> […]

If search results empty then execute certain code

If search results are empty then I want that some code be executed, but how to write such situations programmatically? If !is_search() { certain code } But above doesn’t work.

Using $_GET in Functions.php

I keep getting an undefined index error with this code in functions. What am I doing wrong? function hire_more(){ $hire = $_GET[‘hire_more’]; write_log($hire); } add_action(‘wp_loaded’,’hire_more’);

Colorbox ajax loading of outside HTML content works perfect on localhost but not on server

I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it’s not working on the server. Here is the link to my site – […]

Adding featured image via PHP

Currently I’m working on a project where site is driven by user articles, how it works: Any user goes to compose post page and writes post along with few details, has upload file option for image and then submits Post is uploaded in wordpress and the image attached is set as featured image Admin approves […]

How to make Tag Aliases

How would I build something like this with wordpress. Where multiple tags texts all go to the same page. If you click on the tag “scifi” it takes you to tag “science fiction”. I am not looking for a way to merge them. I want the tag text to vary, but the end page to […]