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

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

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

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

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

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

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

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

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[] = ...


1

If you want to display a single custom field (post meta) then you can use: get_post_meta(); It has three arguments. The ID of the post The name of the post meta field (country_flag) Whether or not the value returned is a single string (in your case it will be); So the usage might be something like this: $country_flag = get_post_meta( $post->ID, ...


1

Data in the WP database is serialized. If you just do a search and replace you'll break your site. You need to reserialize your data as you change it. There are scripts and services that allow you to do a proper Search and Replace. My tool of choice is this one, and it works perfectly. There are also a couple plugins that work (like velvet blues), and I ...


1

@Amirreza Nasiri - Yes that is possible. I have used following plugin to import large size files into WordPress Media library. Please take a look at this: https://wordpress.org/plugins/add-from-server/ I have no affiliation with plugin. I had used it for one of my client project and just found it as suitable suggestion for this question :)


1

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)); ?>


1

To show all categories on a page, you will have to create a new page template. <?php /** * Template Name: Categories Page **/ get_header(); ?> <!-- content --> <div id="content"> <ul class="category-list"> <?php wp_list_categories( 'title_li=' ); ?> </ul> </div> ...



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