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


4

The HTML for the inserted internal links are generated by Javascript, so I'm not aware of any easy way to change it. The HTML generation is controlled from the wpLink.htmlUpdate method (HTML mode) and the wpLink.mceUpdate method (TinyMCE mode), in the /wp-includes/js/wplink.js file. Here are some ideas: Add a query parameter to the inserted links: We ...


3

Filter kses_allowed_protocols (wp-includes/functions.php wp_allowed_protocols) to add your protocol: add_filter( 'kses_allowed_protocols', function( $protocols ) { $protocols[] = 'weixin'; return $protocols; }); The default values are 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', ...


3

One option is to add a class to the Styleselect menu in MCE. Adapted from the "TinyMCE Custom Styles" Codex page you first need to add the style select to the editor: // Callback function to insert 'styleselect' into the $buttons array function my_mce_buttons_2( $buttons ) { array_unshift( $buttons, 'styleselect' ); return $buttons; } // Register ...


2

wp_rel_nofollow() add nofollow attribute to all links so we can not use it or may be I am not sure how. You can use this function to add rel="nofollow" to all external links. This function will check all links in content against your blog/website URL (as internal domain) and add nofollow attribute if both does not match. function ...


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

next_post_link() actually creates an anchor tag, not just the URL. Try something like below to just get the URL: <?php echo get_permalink(get_adjacent_post(false,'',true)); ?>


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

You may use this plugins else you can even create a page with all pdf link to download it. Google Sitemap Generator Sitetree


2

WordPress is strongly opinionated about using absolute URLs. Doesn't mean it's better but it's a choice is makes. The common way to handle it is replace as necessary in database. Please note that if you run replacement on all of database it is extremely important to use serialize–aware tool, or you risk corrupting the data.


2

I usually use tool like this: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ This takes care of any serialized data and can be used to change out staging data from the entire database, not just the post content. Typically a search and replace will look like this: find = staging.site.com and replace with = www.site.com. This ...


1

As your links are generated by get_archives_link(), this is the place where you have to look. Doing so, by inspecting the source , you will notice that get_archives_link() - itself - doesn't give you the possibility to add a CSS class to make the highlighting happen. There is of course the filter hook get_archives_link - or see the source - which could be ...


1

The other question is completely wrong and should not be used previous_post() and next_post() is both depreciated functions and should not be used anymore Never replace WP_Query with query_posts to solve a problem. This actually creates more. Also, query_posts should never be used showposts is also depreciated in favor of posts_per_page To make ...


1

These options are hardcoded into the tmpl-attachment-display-settings Underscore media template in the /wp-includes/media-template file: <script type="text/html" id="tmpl-attachment-display-settings"> <h3><?php _e('Attachment Display Settings'); ?></h3> ...cut... <select class="link-to" ...


1

The the easiest way to create shortlink is by using Jetpack Plugin developed by Automatic guys. This plugin comes with a lot of modules one of them is wp.me shortlink, which will give you the ability to create shortlink for any page/post/custom post in your site. it will be like http://wp.me/QhtyJu, but if you want to use any other shortlink service ...


1

I found the solution to my problem: wp_delete_post(url_to_postid("url"));


1

This is a javascript issue in your theme. You're blocking clicks on elements with the classname .class which contains those links in the file express/includes/scripts/scripts.js: $('.class').click(function(e) { e.preventDefault(); });


1

What would you do if the user uses a proxy and randomizes his IP address? There are numerous browser plugins to simplify that to a click of a button to download multiple times. The same goes for cookies. Aside from that you are trying to collect data that allows to identify users, which is illegal in lots of countries. What (could) work much better is a ...


1

URL-encode spaces beforehand: make_clickable( str_replace( ' ', '%20', $text ) );


1

As asked on the .org support forums XFN is a HTML profile which describes the meaning of extra semantic data that can be added to the rel attribute of outbound links. If you specify relationship information in the link manager for the links you add then this describes the meaning of those attributes to a consumer of your site. You can ...


1

This is something you cannot change in the field it self, but in the template file. Copy and paste here the template file where this option is outputted. Another way will be to add a javascript snippet to you head, if you have such option in you template. Comment here and we'll see what the best solution is. Update: I think best solution for you is to ...


1

If I understand your question correctly, I think what you are looking for is edit_post_link(); To use it just insert <?php edit_post_link(); ?> into your theme. This will output a edit link leading to the current page/posts editor. Update after rewrite of question: You can replace your link with the following to include the posts slug in the url. ...


1

You can use $_GET to get the query string values and then pass it in the $args to create a dynamic WP_Query $after = $_GET['after']; $before = $_GET['before']; and then in the $args if ($after && $before) { $args = array( 'date_query' => array( array( 'after' => $after, 'before' ...


1

you can follow the below Steps : Step 1 : In the wp-admin, go to Appearance -> Menus,put the class on the menu item here "CSS Classes (optional)". If you can't see the "CSS Classes (optional)" in the menu item, then there is "Screen Option" in the right top of the screen and there are the options "CSS Class" under "Show advanced menu properties". Step 2: ...


1

<?php // Display Custom Field Value echo "<ul>"; echo "<li>License Type: ".get_post_meta( $post->ID, 'License Type', true )."</li>"; echo '<li><a href="' . get_post_meta( $post->ID, 'Download Comp', true ) . '">Download Comp</a></li>'; echo "</ul>"; ?>


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

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

Or, you can place this code in your active theme's functions.php: <?php // First, backup the default $postdata $backup = $post; // Now, override the default $tags = wp_get_post_tags($post->ID); // Now, open the if ( $tags ) statement if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = ...



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