Hot answers tagged

11

Hi @Toby: There are lots of ways to accomplish a daily picture blog so I'll just give you how I'd approach it. If I wanted to set up a photoblog on WordPress I'd start with a Flickr account and leverage it (or if you don't like Flickr for some reason you can also look at PhotoBucket, SmugMug, Picasa or one of the other Flickr alternatives.) Using Flickr ...


8

Just hook the default delete_post handler for menus onto the trash action too: add_action( 'wp_trash_post', '_wp_delete_post_menu_item' ); How simple is that!


6

I asked this question over a year ago, and during that time we've added more people to our team and developed a much larger number of sites in WordPress. I wanted to walk through our process in case it might help anyone else. Everything in Git This was something I was doing even as I asked the question, but it's good to call this point out. Using Git has ...


5

The excerpt filter by default cuts your post by a word count, which I think is probably preferable to a character-based substr function like you're doing, and it strings out tags and images as well while doing it. You can set the number of words to excerpt with the filter excerpt_length (it defaults to 55 words, this function from the codex shows how to ...


5

Use the save_post action to run some code when a new show is created, then use wp_insert_post to create your child pages. Here's an example to get you started - First, filter out any saves that are auto-saves, post revisions, auto-drafts, and other post types. Once you know it's your show type, you can check if it has a parent to filter out saves of your ...


3

There is the plugin Unwanted Plugins Remover now. It will remove the plugins Akismet and Hello Dolly on every upgrade. You can filter the plugin list to match only one of those plugins or to add more. From the code: $this->unwanted_plugins = apply_filters( 'unwanted_plugins_list', array( 'akismet/akismet.php', 'hello.php' ) );


3

You don't really need to do this. The the_excerpt() tag automatically checks for an excerpt, and if none exists it uses the first 55 words of the post's content (with all tags stripped). This excerpt length can be controlled by hooking into the excerpt_length filter. If you're trying to include html (images, links, etc) in the automatically-generated ...


3

You'll need a plugin which: Adds a method to the deleted_post action (taking the page's id) Filters: the action is used for posts etc. as well. Updates the menu by wp_get_nav_menu to get its items remove the item representing the page update the menu with wp_update_nav_menu_object.


3

You can add those without a button: register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { //post status and options $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d ...


3

This isn't really a WordPress question - more a generic web development issue. These are some open source tools that can be used for scripting and testing a web browser session. Selenium Cucumber Watir


3

I would actually recommend using the built-in post by email functionality instead. You set up a private email address (mysupersecretaddress12345@mydomain.com) and send both the images and your descriptions to that address. WordPress will then create a new post from your email and automatically attach the image. This is a bit easier than FTP.


3

You could use ajax and the admin_footer-post-new.php hook. The sql would vary depending on whether you want the highest or most recently published order number. The following returns the highest published order number + 1: function wpse155926_set_menu_order() { $ret = array(); if ( check_ajax_referer( 'wpse155926_set_menu_order_post', 'nonce', ...


3

Playing with XML-RPC and underscored custom fields: Let's say we want to set the featured image to a given post with $remote_post_id. We want it to be the attachment with ID equal to 300, so we want _thumbnail_id to be 300. Here are three methods how one could achieve that: Method #1 - Using post_thumbnail It's possible to update/add the featured image ...


3

You'd write a script to loop through a file you created with the data, and process each line one at a time. Inside the loop you'd have code like the following. You would, of course, replace my example values Scotland, Glasgow, its description and its slug with variables representing the data for the row being processed. $parent_term = term_exists( ...


2

the_title filter filters the existing title when it's output on the front end. If you want to set a title when a post is created on the back end, you want to use the title_save_pre filter: function wpa65253_time_title( $title ) { global $post; if ( isset( $post->ID ) ) : if ( empty( $_POST['post_title'] ) && 'time' == ...


2

I'd highly recommend WP-CLI for such tasks. It is a tool that allows installation and configuration of WordPress on the command line. What you are trying could easily be done: wp core download wp core config --dbname=<dbname> --dbuser=<dbuser> --dbpass=<dbpass> wp core install --url=<url> --title=<site-title> ...


2

You could hook into the publish_page transitional status action and use a simple SQL query (via $wpdb) to determine the highest current value of menu_order in the {prefix}_posts table and set the menu_order of the new page accordingly. Example code: add_action( 'publish_page', 'wpse155926_set_to_last_page', 10, 2 ); function wpse155926_set_to_last_page( ...


2

WordPress has built-in support for posting via email. Go to Settings > Writing in your admin and enter your credentials under "Post via e-mail". Note it won't handle Gmail labels (it only works via POP3).


2

The native trash bin It sounds like you're implementing your own version of the WordPress trash system. If you trash a post, the native way, it will get the trash post status and will be automatically deleted (permanently) after 30 days. You can change that in your wp-config.php file with: define( 'EMPTY_TRASH_DAYS', 10 ); for e.g. 10 days. You can ...


2

WP Cron jobs are not reliable as it needs someone to visit the site at the time the event should fire. If you need precise timing, you should use server cron jobs. Anyways, lets look at your code and what is wrong and we can fix it wp is a better hook to use to hook your scheduled event, this is the earliest that postdata available. init is way to early. ...


2

Simply put: no. If you want dynamic updating of your menu items, you would probably be better-served using wp_list_pages() or wp_page_menu().


2

You can use the CSV Importer plugin to import your spreadsheet into posts or even better a custom post type say "school" import school name as post title and the rest as custom fields. Then create a single-school.php file in your theme directory and pull out the name and other fields and you are done. Each school will have Its own page


2

WordPress doesn't have "tweeting" functionality built in. However, post scheduling is built in. You just set the time when you want the post to publish on the edit post screen. If you use a twitter plugin like my own Simple Twitter Connect, and you schedule a post, then it will send the tweet at the same time as the post is published. STC requires some ...


2

Holy schmoly shadowpress - what a risky idea. I imagine one could write a cron plugin to do it, BUT what a risk....Already the auto wordpress multi update feature makes it way too tempting to just hit the update button on a bunch of updates in one go. Recommended 'safe' procedure for system upgrades is something along the lines of: 1) read the ...


2

Not exactly what you are asking for, but very close. There is a concept of 'dropin' plugins that exists primarily to override or add to core functions The dropins will always load. So one ftp's up wordpress including whatever plugin files you want that will create your default environment. These should be in the top level wp_content folder. I have one ...


2

You'll probably have to do your own integration, but here's how I would approach it: Grab an Instagram PHP wrapper: http://www.mauriciocuenca.com/blog/2011/02/instagram-api-implementation-in-php/ OR http://instaphp.com OR https://github.com/cosenary/Instagram-PHP-API Authenticate via an admin option page Iterate through your user images using the ...


2

Try putting this plugin in your wp-content/plugins folder and then activate it: <?php /* Plugin Name: WPSE53245 - Set Tweet category posts as Aside Plugin URI: http://http://wordpress.stackexchange.com/questions/53235 Description: Set Tweet category posts as Aside Version: 0.1 Author: Ashfame Author URI: ...


2

I am not sure what answer you are looking for. Plugins are not something that you directly see when you look at site. Not something site's reputation is based on. I hadn't looked into this specific plugin, but as any of this kind it likely can be used both for perfectly legit and absolutely spammy purposes.


2

I do not think this is built into WordPress currently. This would probably need to be custom-built. It would be some php code that is attached to a cron job. Set the cron job to run every day, and have your php script email out the page. These resources may help: http://ss64.com/osx/crontab.html (via ...



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