Tag Info

Hot answers tagged

13

admin_url() gets you the correct administration page URL (and network_admin_url() to get a network administration page URL) Optionally, you can use add_query_arg() to append arguments to an URL, using an associative array: $page = 'edit_record_page'; $rec_id = 1; $record_url = add_query_arg(compact('page', 'rec_id'), admin_url('admin.php'));


10

Admin Dashboard -> Appearance -> Menus If the theme is WP 3.0 ready, you will have an option to add a custom link (ie external link) on the left side, and you can drag and drop it into the order you want. Justin Tadlock wrote an awesome post about 3.0 menus - http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus If your theme isn't ...


8

you may try to add this to your .htaccess : <FilesMatch "\.(?i:pdf)$"> # Force File Download ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch>


8

<?php global $current_user; get_currentuserinfo(); echo get_author_posts_url($current_user->ID); ?>


8

All you need to do is a simple call in your functions.php: add_action( 'wp_enqueue_scripts', 'add_thickbox' ); That’s it. WordPress will now enqueue jQuery and the thickbox script. By default, linked images aren’t thickboxy yet. You need to: Add a class thickbox to the links manually/per PHP, or Use a second script to add these classes automagically. ...


6

Go to-> http://yourblog.com/wp-admin/options.php Search for: image_default_link_type Type: none


6

Per default wp_list_comments() calls the class Walker_Comment. Its method start_el() calls edit_comment_link() and here we find a filter for your question: It is called 'edit_comment_link' and it passes two variables, the link text and the comment ID, which we can use. The URLs to mark a comment as spam or to delete it are: ...


6

You can do a query like: SELECT ID, post_title, post_date, post_content FROM wp_posts WHERE post_content LIKE '%your-post-title%' ORDER BY post_date to get all posts that linked that old post order by date.


6

After reading this thread I saw that I might need this also sometimes. So here is the result: The internal link checker plugin It adds a meta box at your post edit screens that shows links to all posts who link internally to the currently displayed post. If you want to alter the output (add something for eg.), please use the provided filter. An example of ...


6

If anybody is interested in do the trick, my solution is this: function remove_media_link( $form_fields, $post ) { unset( $form_fields['url'] ); return $form_fields; } add_filter( 'attachment_fields_to_edit', 'remove_media_link', 10, 2 );


5

$my_url = 'my/relative/url.php'; echo site_url($my_url); site_url() when used by itself will return the absolute path to your blog. But, if you add an argument to it, as per my example above, it will prepend the absolute path to your path. Just make sure your URL doesn't contain a leading slash (eg: /this/may/not/work). Finally, if you happen to have your ...


5

This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image_default_link_type field is set to "file" by default. If you set it to "none", then scroll to the bottom and save, it will disable media links. This option has been removed from options.php in WordPress 3. For ...


5

Blogs of a few core committers and regular core contributors you've missed: http://andrewnacin.com (andrew nacin, committer) http://dd32.id.au (dd32, committer) http://scribu.net (scribu, committer) http://austinmatzko.com (filosofo) http://hakre.wordpress.com (hakre) http://www.miqrogroove.com (miqrogroove) http://www.semiologic.com (myself, though I ...


5

It depends on your theme and WP version (you're using 2.9.1 - you should consider upgrading). You can: upgrade to V3+ to use the menu editor that's built in (recommended) more info: http://templatic.com/news/wordpress-3-0-menu-management hard code your theme template with the link added to the end in the HTML modify the theme call to wp_list_pages() ...


5

I'll answer your question below, but have you looked at using embeds? Look here for more information: http://codex.wordpress.org/Embeds The simplest regex for this would look something like http\:\/\/.*\b Here's an example of it in action: <?php $file = 'test.txt'; $fp = fopen($file, 'r'); $contents = fread($fp, filesize($file)); $matches = ...


5

get_adjacent_post(), which is used by all functions that return a (link to) the next or previous post, only has a $in_same_cat argument, which looks at the categories the post is in, not the tags. You could hook into the get_[next|previous]_post_join to modify the join query for your call, but then it's probably easier to copy the function, remove the ...


5

If you don't mind all PDF attachments been forced to be downloaded then you can use something like this: <?php if (have_posts()) : while (have_posts()) : the_post(); $pdf_title = $post->post_title; $uploads_dir = wp_upload_dir(); $attachment_src = get_post_meta( $post->ID, '_wp_attached_file', true ); $pdf_src = path_join( ...


5

Short answer: get_previous_posts_page_link is the function you want: <?php if($url = get_previous_posts_page_link()): ?> do stuff with $url <?php endif; ?> Longer answer: follow the code. previous_posts_link calls get_previous_posts_link. <?php /** * Display the previous posts page link. * * @since 0.71 * @uses ...


5

In short YES, they could have. As anything else could have been implemented as custom post type and/or custom taxonomy. But WordPress is a grown system - now 9 years old - and things are moving slowly to keep most stuff backwards compatible. In short, with WP 3.5, the Links Manager will be moved to a plugin, as you can read in the trac ticket.


5

Well, started as a curiosity, ended up doing a plugin... : After finishing, I went to look in WordPress repository and...yes, there's already one that does it: Easy Blogroll Image : At least, I took a different approach and did something different. Featured Link Image - [edit: released in the WordPress repository, link updated]


5

I tried for a bit and could not get this to work perfectly, but it's close, it's hard to extend with the <form> for the popup styles being hardcoded, thought possible with more work. To get started you can: Enqueue the link popup javascript and styles, the main .js file is wp-includes/wplink.js. Depending on where you loading this you might need to ...


4

To list all pages with title and permalink from one user you need $wpdb->get_results(). The following code is based on this answer: How to count current user's pages? First, we move the counter into a separate helper function; we might need it later again: /** * Get all post IDs and titles of a type for a user. * * @param int $user_id * @param ...


4

Use the function make_clickable(): $text = get_post_meta( get_the_ID(), 'my_key', TRUE ); echo make_clickable( $text );


4

WordPress has a built-in function for removing protocol and domain from absolute URLs, wp_make_link_relative, located in /wp-includes/formatting.php: function wp_make_link_relative( $link ) { return preg_replace( '|https?://[^/]+(/.*)|i', '$1', $link ); } To apply this function to (e.g.) permalinks, simply add a filter, as such: add_filter( ...


4

Two possibilities: Use the the_content-filter, or just call it in your template. You can just throw the plugin in your folder, or add one (or both) function(s) in your themes functions.php file. The filter triggers only for the post format link, while the template tag can be used more universal - in the loop. As a plugin <?php ! defined( 'ABSPATH' ) ...


4

Use the ugly link instead of the pretty link. For example, if your post id is 123, you can link to http://www.yoursite.com/?p=123. This will automatically get rewritten to your current pretty permalink. If you do it relative from the root, it also keeps the link intact if you change your domain name. (ex. href="/?p=123"). To find the post ID, hover over ...


4

To be ON TOPIC on the QUESTION (firefox) i dont think the approach to use delicious as intermediate step is preferred because: you lose the hierarhical taxonomy applied in firefox (they way you structured things) you lose the favicons as gathered in firefox you lose the information added by dividers between links you lose information on the order of ...


4

A great starting point would be Mike's answer to the question about cloning CrunchBase. You'll want to do something similar with custom post types for entries in your directory. If you want to allow visitors to submit sites, you could perhaps use the TDO Mini Forms plugin to allow visitors to create a new listing, and adjust the settings so that any new ...


4

These can be nicely done with WordPress using custom post type for link submission, so then the rest becomes very easy using a few plugins: Voting - CMS Vote Up Social CMS News will handle the voting. Easy link submission - simple custom front end post form would do the job (ex: here or you can use plugins like Mini TDO, Gravity forms... Member creation ...



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