Tag Info

Hot answers tagged

4

Add that to your functions.php: function wp_link_query_mod ( $results ){ if( count( $results ) ){ for( $i=0; $i<count($results); $i++ ){ $results[$i]['permalink'] = wp_get_shortlink( $results[$i]['ID'] ); } } return $results; } add_filter('wp_link_query', 'wp_link_query_mod'); This hook is only usable since WP ...


3

There is no plugin to remove anchor tags with that url ( atleast I don't know any ), but you can replace the url with this plugin http://wordpress.org/plugins/search-and-replace/


3

You can use the Search Regex plugin. This will allow you to create a regular expression to intelligently search and replace across all of your posts. After you activate the plugin, go to Tools, Search Regex. If you want to remove all links to http://example.com, here is one regular expression you could try: /<a ...


3

Well if your code is working properly and the only problem is that it displays when no one is logged in then try the code below. Because right now you are saying "Hey WP just echo out this" - so it does it. You need to change it to: "Hey WP if the user is logged in show the link to his page and if not show the login link" like that: <?php if ( ...


2

It's not built into core, but it's certainly possible to add, however - I wouldn't consider it a good idea to have a single post available at multiple URLs, so a redirect is probably best. Of course, it will require a bit of PHP, as WordPress doesn't operate on magic or willpower. First, we hook a function to the parse_request action, which runs when ...


2

Add a rewrite rule and extra query vars to handle incoming requests, direct the rewrite rule to a single page post type, create a custom page template for that page, then do whatever querying you need using the query vars set by your rewrite rule.


2

Create a page with the name links. Pages >> Add New into your wordpress panel. Just name it links and publish. See below. Now go to your theme folder wp-content\themes\YOUR_ACTIVE_THEME_FOLDER and create a page page-links.php. And paste this code in page-links.php <?php $the_query = new WP_Query(array('post_type' => 'post')); ...


2

If you are talking about menus and your theme uses the Menu API, then upload the PDF to a publicly accessible server-- doesn't have to to be the one your site uses-- then go to Appearance -> Menus, Navigate to a menu, or create one find the "Links" dialogue, input the URL and the link text Save


2

The plugin you mentioned is only a single function so it shouldn't be too heavy on your setup. It uses the comments_template filter to inject the pingbacks/trackbacks list into your page. But the plugin is using an extra manual SQL query and the template is constructed by hand, so there's a room for improvements/simplifications. A simple demo plugin with ...


2

Please refer to this link http://codex.wordpress.org/Changing_The_Site_URL It is possible to set the site URL manually in the wp-config.php file. Add these two lines to your wp-config.php, where "example.com" is the correct location of your site. define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');


2

It's a valid theory and under some circumstances such micro-optimization might make a difference (making content fit into single packet rather than be split into two). However you misinterpret the size information. 8.5KB is gzip-compressed version of your page. Since repeats of same string are highly compressible, your optimization won't reduce this by 5KB. ...


1

This will display them before the DISQUS comment form but not the count add_filter( 'comments_template', function( $pings_before_dsq_comments) { if( !function_exists( 'dsq_is_installed' ) || !dsq_is_installed() ) return $pings_before_dsq_comments; wp_list_comments( array( 'style' => 'ul', 'type' => 'pings' )); ...


1

The solution for this is, in my opinion, divided into two steps. The first step is to set the variable, which defines the affiliate, that sends you the visitor. The second step is to display an appropriate logo based on the value of the first variable. The solution for the first step would probably look somewhat like this: if( isset($_GET['affiliate']) ...


1

You can use the count property of the taxonomy term and if it is > 1, then show the term linked to archive. // inside loop, get the terms of a custom taxonomy for the current post $terms = get_the_terms( get_the_ID(), 'your_custom_taxonomy' ); // cycle the terms and display the name, linked to archive if term count is > 1 foreach ( $terms as $term ) ...


1

For anyone who comes across this question. Related Posts for WordPress has the ability to automatically link posts and allows you to manually add, edit and remove the related posts. You can download it for free here: http://wordpress.org/plugins/related-posts-for-wp/


1

You should be using home_url() ( or something similar ) in your links for theme files when linking to pages. This will allow the domain to change and not affect your hardcoded links - assuming the ID's are the same of course. <a href="<?php echo home_url();?>/?page_id=634">Link</a> Good luck!


1

get_post_meta() only returns the output, but does not print it. You have to use either echo or the_meta() to print the actual output. href="<?php echo get_post_meta(get_the_id(), 'ramco-videos-link', true);


1

Create a page, call it "Blog" Settings->Reading... select your new "Blog" page in the drop down next "Posts page" In Appearance->Menus find your main menu. On the left, open up the "Pages" panel Find your page named Blog Check it and click "Add to Menu Save the menu Profit


1

What web addresses are in your Dashboard > Settings > general? if it is the old site, try changing it, if changing is impossible, try putting the following code at the top op wp-config.php: define('WP_HOME','http://www.new_site.com'); define('WP_SITEURL','http://www.new_site.com'); Are the site urls correct? Try searching your page template and see if you ...


1

I invoke the link dialogue within the metabox class I use for development. Its a tad hacky but can be done, until something more robust is developed. You can invoke the link box by first enqueing the required js, and then interacting with the wp-link js files methods. Make sure you have enqueued wp-link 1 / wp_enqueue_script( 'wp-link' ); 2 / Set up your ...


1

Rather than "still on" page the user actually goes to the link and then sent back after post is deleted. From your description and quick look at code this is probably line that sends user back: wp_redirect( add_query_arg('deleted', 1, $sendback) ); Since destination is filtered inside wp_redirect() $location = apply_filters( 'wp_redirect', $location, ...


1

When in the Appearance > Menus admin screen, click the Screen Options tab in the upper right corner, then under Show advanced menu properties tick the Link Target box. You'll now have a check box for each menu item labeled Open link in a new window/tab. That said, many people these days do not take kindly to this sort of behavior. I think best practices ...


1

Arguments of wp_link_pages() Maybe this will work for you: $args = array( 'before' => '<ul><li>' . __( 'Pages:' ), 'after' => '</li></ul>', 'link_before' => '', 'link_after' => '', 'next_or_number' => ...


1

The page ID can vary in different installation, and it can't be changed, so an option is to use get_page_by_path because the page slug can be easily changed: <div class="my-link-box"> <?php $page = get_page_by_path('my-page'); ?> <a href="<?php echo get_permalink($page); ?>"><?php echo $page->post_title; ?></a> ...


1

In functions.php or likewise file: update_option('image_default_link_type','none');


1

Wordpress does in fact add a current class by default: check where it says: <li id="menu-item-1688" class="current-menu-item"> Within your source code. Now as for the other item, this is a bit tricky. There is two ways to do it assuming that you need the last item for styling. Option #1 is with pure CSS using the last-of-type selector. Option ...


1

Problem is that the function you use run after http header are sent, so it can't redirect. You have to use another way. One method can be intercept the global menu variable and add a new menu item with all properties: add_action( 'admin_menu', 'register_web_menu_page', 999); function register_web_menu_page () { global $menu; $menu[9] = array ( ...


1

I think this is almost what the article Add Private Content to Posts via Shortcode talks about. But it's only for registered users: add_shortcode('private', 'private_content'); function private_content($atts, $content = null) { if ( is_user_logged_in() ) return '<div class="private-content">' . $content . '</div>'; return ''; } ...



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