Tag archive for "php"

What happened to bitcoin-24.com?

Bad: Licensing, Data leak, Password security, Accounting, DB integrity and Float arithmetic. Donations: 16zN9HGvB7fBmfWgysWpJ5wTNUf82fFDNN No BTC? 2014-10-02 Bitcoin24 down again The "new" site has been down for around 24 hours now. The cloudflare error is a rather disturbing "SSL handshake failed". I have been told that neither fiat nor bitcoin ... more

Custom taxonomy with meta data

This snippet shows how you can add metadata to your existing custom taxonomy. So you can use update_metadata() and get_metadata() on your taxonomy. The filter on switch_blog is only necessary if the code runs on a blog network (recommended to implement anyway). The name of the database table is very ... more

Order posts in a $wp_query manually

Build a custom WordPress query and order the posts however you want them. Notice that this won't work properly if you page results, so it is only useful in very specific cases. Btw, wrap everything into your class and get rid o the global var when you use this ;-) more

Dynamic search form for a WordPress 404 page

Show the user a useful search form when on a 404 page. Turn the query string into a search. more

Extract HTML with PHP’s DOM extension

I recently had to parse HTML with PHP and had a look at PHP's DOM at last. Here's a way to extract an element's content by ID: <?php /** * Extract an element by ID from an HTML document * Thanks http://codjng.blogspot.com/2009/10/unicode-problem-when-using-domdocument.html * * @param string $content A website * ... more

WordPress rewrite rule for custom taxonomies

This makes it possible to have the taxonomy below some post type slug, e.g. the post type is at /cars/ and taxonomies are at /cars/manufacturer/, /cars/year-of-construction/ etc. You want to register the taxonomy with the same $slug. more

Add custom post types to the WordPress query

Run the filter whenever you want your post type in the main loop. Add is_home(), is_category() etc. Example is for the post type 'paste'. more

Get a category name/slug/id for a post or archive page

There's obviously a little context missing for this paste, but the basic idea should be clear ;-) more

Simple upload field for WordPress plugins/themes

With this you can upload images through your plugin/theme. They are saved as attachments. Please add nonce fields for security reasons. more

Log in a WordPress user programmatically

With this snippet you can log in a WordPress user automatically. more