Articles of php

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 […]

Missing argument 3 for wp_register_sidebar_widget()

I installed the Deprecated Calls plugin and it’s telling me to change register_sidebar_widget() and register_widget_control(), essentially add wp_ first. I did but I’m getting Missing argument 3 for wp_register_sidebar_widget() and wp_register_widget_control() Is it ok if I put the default none for the 3rd arg?

$wp_filesystem returns NULL. What are the dependencies?

I need to obtain a reference to the $wp_filesystem object. In the test below, the var_dump($wp_filesystem) returns NULL. What additional files are required in order to properly set up $wp_filesystem? I was expecting that since its called in file.php, loading that file would be sufficient to load the object. <?php require(‘../../../wp-blog-header.php’); require(‘../../../wp-admin/includes/file.php’); $mytest = somefunction(); […]

How do I alter the comment form 'allowed tags' text in a plugin?

I’m using the PHP Markdown plugin, and I’d like to modify it so that it adds some text to the bottom of the comment form indicating that Markdown is supported in comments. I’ve been modifying my theme to do this, but the theme is updated quite frequently and I don’t want to create a custom […]

wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated

So, I have a plugin that uses Ajax to dynamically build the post content piece by piece for a custom post type. Once the user has build their page, they hit Update/Publish and Ajax sends the entire built page to a the main plugin PHP file where I am attempting to call wp_insert_post(). Here is […]

wp_enqueue_style with style.php and WordPress functions

I use wp_enqueue_style to add my stylesheet, like this: <?php wp_enqueue_style( ‘theme-style’, get_template_directory_uri() . ‘/style.php’, false, ‘1.0’, ‘all’ ); ?> It works fine BUT I need to run a WordPress function in the style.php file. The stylesheet file does not know that the core exists. This is what I’ve heard It’s bad to include wp-load.php. […]

Add title, post content, and category like add_post_meta and update_post_meta

How can I update/add a new title, post content, and category to a post with hard PHP code similar to add_post_meta(), update_post_meta()?

How to override .htaccess with new rules without ftp or edit it manual

I want script will add new rules to current .htaccess and user no need to ftp or edit it manually. Example, I use timthumb for resize image on my theme and want rewrite the URL and current .htaccess will be something like this. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^images/thumb/(.*) timthumb.php?filename=$1 RewriteRule ^index\.php$ – […]

How can I show the post thumbnail from the most recent of a certain post type, in widget?

I’m using the excellent PHP Code Widget plugin, and want to create a widget that displays the post thumbnail (aka featured image) for the most recent ‘project’ post. Here’s the code I have so far, but it isn’t producing the desired result. This actually outputs nothing. <?php global $post; $args = array( ‘post_type’ => ‘project’, […]

Link for Most Recent Post

I am trying to make a comic website that has arrows pointing to First/Previous/Next/Latest on single.php. I’ve linked the first 3, but I’m struggling in figuring out how to link to Latest. It doesn’t feel like it should be that hard, but Google only gave me ways to link it in the menu. Here’s the […]