Tag Info

Hot answers tagged

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

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


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

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. ...


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

Damn, I came with a solution after I posted it.... echo ' <a href="http://www.bing.com/search?q=' . urlencode($titletest) . '">' . $titletest . '</a>';


2

If you manually provide an excerpt for the post WordPress will use the one you provided instead of automatically generating one. Any HTML links you include in your manual excerpt will still be displayed correctly. Or you can leave the links out and just include the text you want. To preserve HTML links in the automatically generated excerpt you could try ...


1

Is there a way of excluding media attachment content from the_excerpt()? Yes. There are many ways. Here are a few: Use a manual excerpt. Write more text before the first link to an image in the post. Shorten the length of the excerpt. Use the 'get_the_excerpt' filter to change content of the excerpt.


1

I think setting 'publicly_queryable' => false should solve your problem!


1

Link to none would only remove the hyperlink from the media. If the user clicks on the media, the media will not open separately in a window / tab. There is no way to hide the link to the resources. There is no security threat of accessing other files from external user.


1

You have a couple options. Both involve using the post ID because that doesn't change. You could use the ugly URL in the form of http://www.example.com/?p=23 where ?p=23 would be the ID of the post. You can use a shortcode that accepts the post ID and outputs a link using get_permalink(). The following shortcode would be used like this. [postlink ...


1

WordPress uses set of regular expressions to parse urls (so called rewrite rules). It matches them in some order and stops when first matching rule is found. It's a little bit hard to say what rule is matched in your case. We don't know what are your permalink settings and what other changes to rewrite rules are made. To see all these rules, just add this ...


1

Simple solution drop this in your functions.php function your_get_comment_author_link () { global $comment; if ($comment->user_id == '0') { if (!empty ($comment->comment_author_url)) { $url = $comment->comment_author_url; } else { $url = '#'; } } else { $url = ...


1

This worked for me... /* * Sets "Open link in a new window/tab" to checked by default */ function ahu_after_wp_tiny_mce() { ?> <script type="text/javascript"> jQuery( function() { jQuery( 'input#link-target-checkbox' ).prop( 'checked', true ); } ); </script> <?php } add_action( 'after_wp_tiny_mce', ...


1

Have you tried something like: /*Get number of entries*/ function get_entries_num( $id ) { $count= count_user_posts( $id ); if ($count == 1) { return '<a href="'.get_author_posts_url($id).'">'.sprintf(__('%s total post','upme'), $count).'</a>'; } else { return '<a ...


1

Relative URLs are best avoided in WP, so use absolute URLs instead. Also, you should load javascript files using the correct method, ie by using the wp_enqueue_script() function hooked to the wp_enqueue_scripts action hook. Doing both of these things will sort out your issue. Using wp_enqueue_script() will also allow you to define dependencies so, for ...


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 ''; } ...


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

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 ...



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