Custom priority with the_content filter based on user input

Save the priority in your options and pass that value to your add_filter: add_action( ‘template_redirect’, ‘wpse_81687_prepare_filter’ ); function wpse_81687_prepare_filter() { $my_options = get_option( ‘my_options’ ); $priority = isset ( $my_options[‘content_filter_priority’] ) ? $my_options[‘content_filter_priority’] : 10; add_filter( ‘the_content’, ‘ald_crp’, $priority ); } In my example I register the the_content filter during template_redirect because it is not … Read more

Archive for custom fields?

WordPress does not support by default custom_fields archive like for taxonomies (yeah, taxonomies can have categories) but we can create a destination page with page template (linked from the listed custom_field) and added a searching on the custom_field, like this (from the listing page): <?php if (get_post_meta($post->ID,’_my_meta’,TRUE)) : $key_meta = get_post_meta($post->ID,’_my_meta’,TRUE); endif; ?> <a href=”https://wordpress.stackexchange.com/questions/92473/<?php … Read more

Paginate yearly archives for a custom post type

Your regex cannot work: $wp_rewrite->preg_index(3) doesn’t match anything, because you capture only one part in ‘/([0-9]{4})/?$’, not three. Try to add the page parameter: $pagination_base = $GLOBALS[‘wp_rewrite’]->pagination_base; $month_archive = array( $myqueryslug . ‘/([0-9]{4})(‘ . $pagination_base . ‘/(\d+))?/?$’ => ‘index.php?year=” . $wp_rewrite->preg_index(1) . “&post_type=” . $myqueryslug . “&paged=’ . $wp_rewrite->preg_index(3) ); I haven’t tested it, just … Read more

Rewrite and replace url wp-admin/edit.php and wp-admin/post-new.php

The technical answer to this is to put an .htaccess file inside your wp-admin folder with this code: # Remove .php from pages so you can use /wp-admin/edit RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php # Use /wp-admin/addnewpost RewriteRule addnewpost post-new.php The practical answer is that this is completely horrible, involves … Read more

How to load plugin static data from cloudfront

There are already plugins to do the rewrites. For example, CDN Linker. By default, it loads / rewrites the static content for ‘wp-includes’ and ‘wp-content’. You may change this default behaviour after the installation / activation or fork it to let this plugin rewrite only the data from the plugins directory.

Taxonomy page wpml dropdown not working

The default language selector is pretty crap TBH. I created this function using jQuery, you will have to amend to fit your template. function language_selector(){ $languages = icl_get_languages(‘skip_missing=0&orderby=code’); $current_lang = ICL_LANGUAGE_CODE; if(!empty($languages)) { ?> <div id=”language_list”> <div class=”current”> <img src=”https://wordpress.stackexchange.com/questions/95978/<?php bloginfo(“url’); ?>/wp-content/plugins/sitepress-multilingual-cms/res/flags/<?php echo ICL_LANGUAGE_CODE; ?>.png” alt=”<?php echo ICL_LANGUAGE_NAME; ?>” /> <?php echo ICL_LANGUAGE_NAME; ?> <i … Read more