Attn! Always use a VPN when RSSing!
Your IP adress is . Country:
Your ISP blocks content and issues fines based on your location. Hide your IP address with a VPN!
Bonus: No download restrictions, fines or annoying ads with any VPN Purchased!
Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

WordPress › Support
    0 0

    Wordpress advises against using php to build panels for the theme customizer. How do I implement custom panels and dynamic sections using the JS API?


    0 0

    Hi All,

    i'm looking for two pieces of code that can help me with the following:

    I got posts and pages with a custom menu. These posts/pages got a custom template activated. The templates contains the menu for the specific posts and pages. This way i can order pages/posts in two different categories.

    Now i like to change the search function; the search output should be based on the active custom menu category.

    I named menu 1: Benelux and menu 2: International

    1: First peace of code needs to be for the searchform.php
    The code should look at the current active menu(category) and the search result should be based on the active menu.

    If the menu is for example "Benelux" then the search result should only display pages/posts from the custom taxonomy that i made <input type="hidden" name="location" value="benelux" />
    Or if the active menu is "International" then display pages/posts from the custom taxonomy <input type="hidden" name="location" value="international" />

    I found the following code to get the menu category...not sure if this is useful..

    (wp_nav_menu( array(
        'menu' => 'benelux'
    ) )

    2: Second peace of code is needed for the search.php (header).
    Because if the output should work correctly than we also need to change the menu for this search result page. Default the search.php uses the main menu.

    So the following code needs to see if the pages/post contain taxonomy benelux or international and change the menu accordingly.

    It would just be really awesome if this is possible.

    Greatings,
    Taro


    0 0

    add values of a variable with string, within another variable that also contains string, but insert in the middle of the text, eg
    I have a text with 100 words, and I have another variable also with a string value, say a word, as I put that word in this text, and text in the center. say there position by 49 or 50 or 51 etc ...Thanks :)


    0 0

    So I use the "PreimumPress" Classifieds Blue child theme, and the code I have below will check if there is a “bad word” entered into the Keywords input/field and alerts the user about it once they click on the Save Listing button. The problem though is that it ONLY alerts the user when there is just ONE of the specified “bad words” in that field. It won’t trigger the alert when the “bad word” is found within a whole sentence. So I need help with two things…

    – Can anyone help me tweak this code so that it will trigger the alert when the “bad word” is found ANYWHERE within that field, even if there are other words.
    – Can anyone help me have this “alert” happen when the specified “bad words” are in ANY field, not just the “keywords” field.

    *For reference, my website is http://www.lakomai.com

    THANKS!!

    <script>
    jQuery(function() {
    jQuery("#MainSaveBtn").on("click",function() {
        var name = jQuery("input:text[name='custom[post_tags]']").val();
            var badwords = ["word1", "word2", "bad word3"];
    
            if(jQuery.inArray(name, badwords) !==-1)
                {
                    alert("Your Listing Contains Bad Words, Please Remove Them Before Proceeding");
                    return false;
                }
    });
    });
    </script>

    0 0

    I am relatively new to getting using jquery, but a client wanted something where when you hover over a child div, the parent divs background would change. A rudimentary version of what I came up with for a solution can be found here jsfiddle.

    But when I took the code and tried adding it to my site, it just will not work. I am not sure if I am missing something very simple, or something is way wrong with the code I was using. I have tried adding the script in the header, and also adding it as an external js file.

    The site in question can be found here with the section "Explore" where the code is being used - http://www.aoftheibuild.com.php56-9.dfw3-2.websitetestlink.com/


    0 0

    I'm having an issue which is caused by custom query var named date I've added using query_vars hook. When date parameter is present in the front page URL (https://example.com/?date=23.08.2016), WordPress is loading posts archive instead of just front page. When other random params are added to the link (https://example.com/?foo=bar) or no params are present, front page is loaded correctly the static page I defined.

    Posts page in the backend is different than front page.

    I added custom query var using following code:

    my_query_vars( $vars ) {
        $vars[] = 'date';
        return $vars;
    }
    add_filter( "query_vars", "my_query_vars" );

    Any idea why such a thing happens?


    0 0

    Hello,
    for my design it is more complaisant to use shortcodes instead
    of url because the shortcode provides some additional formatting.

    Example:
    When you like to have a shortcode resolved by a main menu item,
    this seems not to be possible and also plugins are not really working
    (in my case).

    When you like to add a RSS feed to sidebar, only an URL is accepted,
    not a shortcode which could implement this RSS more convenient.

    (To be able to use shortcodes where ever URL is accepted would be a nice
    standard feature for next WP release. If you can't extract url from shortcode -> 404).

    My question:
    Is there a general workaround to use shortcodes in URL fields, like functions handle this ?
    Thank you


    0 0

    Hi,

    I need some help with this bit of code ... the thing is I am trying to deny access to a role name for a specific part of the admin area.

    /*
     * If user is not a SuperAdmin, when they try to access the below URLs they are redirected back to the dashboard.
     */
    function restrict_admin_with_redirect() {
    
    	$restrictions = array(
    		'wp-admin/admin.php?page=wpca-settings'
    			);
    
    	foreach ( $restrictions as $restriction ) {
    
    		if ( ! current_user_can( 'manage_network' ) && $_SERVER['PHP_SELF'] == $restriction ) {
    			wp_redirect( admin_url() );
    			exit;
    		}
    
    	}
    
    }
    add_action( 'admin_init', 'restrict_admin_with_redirect' );

    I am placing this code to my functions php but I can not get it to work.

    Any help would be much appreciated


    0 0

    Hi!

    I have a jquery code with shortcodes from the plugin draw attention, and im struggling to try to hide some divs shortcodes, before I use jQuery show.

    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    			jQuery( document ).ready(function() {
    			        jQuery('.showSingle').on('click', function() {
    			            jQuery('.targetDiv').hide();
    			            jQuery('#div'+$(this).attr('target')).show();
    			            e.preventDefault();
    			            });
    				});
    			});
    
    			<div class="buttons">
    				<a  class="showSingle" target="1"><button>1</button></a>
    				<a  class="showSingle" target="2"><button>2</button></a>
    				<a  class="showSingle" target="3"><button>3</button></a>
    				<a  class="showSingle" target="4"><button>4</button></a>
    			</div>
    
    			<div id="div1" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="48"]');?></div>
    			<div id="div2" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="87"]');?></div>
    			<div id="div3" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="92"]');?></div>
    			<div id="div4" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="111"]');?></div>

    How can i hide div2, div3 and div4, before I click on button?


    0 0

    Hey, here is one way to do that:

    HTML

    <div class="moveimg">
    	<img src="http://placehold.it/350x150/ff0">
    	<div class="moveimg-hover"><img src="http://placehold.it/350x150/cf0"></div>
    </div>

    jQuery

    jQuery('body').on('mousemove', '.moveimg', function (e) {
    	jQuery(e.currentTarget).find('.moveimg-hover').css('width', e.offsetX);
    });

    CSS

    .moveimg { position: relative; display: inline-block; }
    .moveimg-hover { position: absolute; top: 0; width: 0; height: 100%; overflow: hidden; }
    .moveimg-hover img { max-width: none; }

    0 0

    Hi there,

    i would like to add a product count on top of my shop page (woocommerce) to show how much products are left when filtering. I added the following to my functions.php

    // [product_count] shortcode
    function product_count_shortcode( ) {
    	$count_posts = wp_count_posts( 'product' );
    	return $count_posts->publish;
    }
    add_shortcode( 'product_count', 'product_count_shortcode' );

    And dropped that shortcode [product_count] on top of the page. Now it shows the ammount of products in total but i want something like when i filter the products it says something like "12 out of 300 products". I know it was there once but for no reason it is not there anymore. Can i fix this by adding some kind of function or do you have any other solution?

    Thanks for your time,

    Sjoerd


    0 0

    I need my WordPress search functionality to display all the pages with the inserted keyword first, then posts(starting from the latest which was inserted) and then everything else that comes up with the keyword. What should I change in my code?

    <div class="content">
        <h1><?php _e('Search', 'E'); ?></h1>
            <div class="search-area">
                 <?php get_template_part('searchform'); ?>
            </div>
    
        <p><?php _e('Your search results for', 'E'); ?> '<?php the_search_query(); ?>'<?php _e(':', 'E'); ?></p>
    
            <div class="search-results">
                 <?php if( have_posts() ) : ?>
                       <?php
                           posts_list = array();
                           $posts_list[] = '<ul class="post-list">';
    
                                    while( have_posts() )
                                    {
                                        the_post();
    
                                        array_push($posts_list,
                                            sprintf(
                                                '<li class="item">
                                                    <h2 class="title"><a href="%s">%s</a></h2>
                                                    <p class="text">%s</p>
                                                </li>',
    
                                                get_permalink(),
                                                get_the_title(),
                                                wp_trim_words(get_the_excerpt(), 45)
                                            )
                                        );
                                    }
    
                                    $posts_list[] =  '</ul>';
    
                                    echo implode("\n", $posts_list);
    
                                    if(function_exists('wp_paginate'))
                                    {
                                        wp_paginate();
                                    }
                                    ?>
                                    <?php else : ?>
                                    <p><?php _e('<div class="no-results"><p>Suggestions:</p><ul><li>Make sure all words are spelled correctly.</li><li>Try different keywords.</li></ul></div>', 'E'); ?></p>
                                    <?php endif; ?>
                         </div>
                    </div>

    0 0

    Instead of having the main admin sidebar menu, I would like to just have the mobile hamburger icon in the admin bar at all times.

    I have played around with the css and the best I could get was just the collapsed side bar menu at all times.

    Any help would be great.


    0 0

    I am trying not to repeat a post I made in the Plugins forum. This is just a more general question. I want to reverse or negate an action for a plugin only on certain pages. But I need to make sure the file I created with the script to override the plugin javascript gets loaded last. Is there a known or common way to make sure a file - let's call it custom.js - gets called last when the page is loading in the browser? Just adding an action through wp_enqueue_scripts in the functions.php file doesn't seem to make it load last. It loads. But the plugin loads later and kills what I was trying to reverse or negate.

    Thanks.


    0 0

    I moved a company's site to another host. Previous developer and office manager are out of the picture. Site has three dozen plugins. Login link in the menu bar disappeared. Plugins are Theme-My-Login and Place Login. But, I don't understand how they create the wp-login.php page or work with it. I haven't found documentation yet explaining how wp-login.php works. The plugin docs assume I know how they work.

    How do I recreate a link in the menu to go to wp-login.php?


    0 0

    I have set the default layout, so that on theme activation the default layouts shows on front-end without having to save anything in the database. But the problem is the default layouts doesn't show on theme activation. It shows blank page.

    //File - default.php
    <?php function prefix_option_defaults() {
    
    //default values
    $defaults = array(
        'frontpage_layouts' => 'layout_3',
    );
    
      $options = get_option('prefix',$defaults);
    
      //Parse defaults again - see comments
      $options = wp_parse_args( $options, $defaults );
    
    return $options; }

    Calling the defaults at the top of header.php file

    //File - header.php
    global $prefix;
    $prefix= prefix_option_defaults();

    Here's the code I'm calling the layouts from -

    //File - landing-page.php
    if ( get_option( 'frontpage_layouts' ) === 'layout_1' ) {
    
           get_template_part( 'frontpage/content', 'cta' ); }
    
        elseif ( get_option( 'frontpage_layouts') === 'layout_2' ) {
    
            get_template_part( 'frontpage/content', 'cta2' ); }
    
        elseif ( get_option( 'frontpage_layouts' ) === 'layout_3' ) {
    
            get_template_part( 'frontpage/content', 'cta3' ); }
    
        else ( get_option( 'frontpage_layouts' ) === NULL ); {
    
             get_template_part( 'frontpage/content', 'cta3' ); }

    My customizer options are saved as -

    get_option('frontpage_layouts')

    I'd appreciate if anybody can help me

    0 0

    Hi,

    I've seen this issue being addressed over and over again, but i haven't come across a 100% working solution for everyone that is trying to create custom AJAX calls on content that contains shortcodes. Some people suggest making the AJAX call trough wordpress frame (trough admin ajax)

    - https://codex.wordpress.org/AJAX_in_Plugins

    while others say its better to include core wordpress functionalities in your own file (including wp-load.php in your php file)

    - https://wordpress.org/support/topic/running-shortcode-inside-ajax-request?replies=9#post-5324569

    I have tried both versions, but actually none of the mentioned techniques work - meaning, the shortcodes aren't parsed.

    F.ex. i'm trying to 'load more posts'. Content in the posts is created with DIVI builder. Shortcodes in the response are however, unparsed.
    The only way the response is correct is in the second example, but if i include the wp-blog-header.php instead of wp-load.php. But if i do include the wp-blog-header.php, i get a 404 error (im guessing because of security reasons, cause the actual response is in this case correct; still not displayed as its a 404).

    Is there a reliable way to achieve displaying shortcodes trough AJAX? I mean, it can't be THAT hard if there are thousand AJAX plugins that work correct on this principle.


    0 0

    For some time I'm trying to write a plugin for my site that hides certain tags from normal users but staying visible to administrators. I also searched for answers and while finding some they don't work already because answers are few years old.

    Any ideas how to achieve this or is it even possible?


    0 0

    I have a "company" post type. I need to show how much money company raised by rounds. It will be something like:
    Round 1 - $1,000,000 Date - 08/10/2016
    Round 2 - $1,500,000 Date - 06/11/2016

    I might have multiple rounds. Should I create a rounds table and just relate it to the post type? Or should I create multiple meta-fields?


    0 0

    I am seeing an error message appearing on some Safari devices (but not others). I have seen this happen on iphone 4 & 5 but not 6 and it also happens on ipad air. I think it is because when Safari's private mode is on, then the browser's LocalStorage is not writable. This is the error message.

    "Local storage is not supported by your browser. Please disable "private mode" or upgrade to a modern browser..."

    I wondered if there is a simple way to fix it and if anyone else had come across this and had a fix.


    0 0

    I can think of a number of ways to go about doing this. I'm looking for the most efficient way. Menu looks like this:

    catArchive1 [num_new_posts] catArchive2 [num_new_posts] catArchive3 [num_new_posts]

    ^^[num_new_posts] being the number of new posts

    Assuming we have a cookie value set for the users last visit $_COOKIE['lastvisit'].

    I could do something like the follow for EACH menu/category

    $args = array(
     'category' => $cat_id,
     'posts_per_page' => -1,
     'date_query'     => array( 'after' => $_COOKIE['lastvisit'] ),
     );
    
    $new_posts = get_posts($args);
    $num_posts = count($num_posts); // Number of new posts

    Of course, this is another query for each menu item. Any ideas how to combine this into one and still know how many new posts in each category?


    0 0

    Greatings folks!

    I have an issue - in my website i have sidebar recent post/related posts witch is using featured images as thumbnail.

    My problem is that: my image is 600x100 and wordpress system resizing image and cropping and then I dont see full image as thumbnail becouse wordpress cutted half image.

    Maybe for this issue is solution ?
    Like if image is 600x100 wordpress makes thumbnail smaller but full sized ?


    0 0

    Can anyone please tell me how can I show multiple CPT by category in archive page. Lets say I have CPT “product” and another CPT “news”. I managed to get the CPT product to list on my archive page but I can't list news page. I renamed archive-news.php. I tried this code to list my both product and news but it only shows my product page which is on my archive page. It doesn't show archive-news.php.

    //add multi custom post type to tags and categories
    function add_custom_types_to_tax( $query ) {
    // Return right away if in admin or not working on the main frontend query
    if ( is_admin() || ! $query->is_main_query() ) {
    return;
    }
    
    // Check if we're on a category or tag archive. If so, add our post type
    if( ( $query->is_category() || $query->is_tag() ) ) {
    // Get all your post types
    $post_types = array('post' , 'product' , 'news');
    $query->set( 'post_type', $post_types );
    }
    }
    add_action( 'pre_get_posts', 'add_custom_types_to_tax' );

    My archive page code is:

    <?php
    if ( have_posts() ) :
    the_archive_title( '', false );
    the_archive_description( '<div class="taxonomy-description">', '</div>' );
    
    while ( have_posts() ) : the_post(); ?>
    
    <h3><?php the_title(); ?> </h3>
    
    <?php endwhile;
    
    the_posts_pagination( array(
    'prev_text' => __( '<<', 'twentysixteen' ),
    'next_text' => __( '>>', 'twentysixteen' ),
    'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( '', 'twentysixteen' ) . ' </span>',
    ) );
    
    else :
    get_template_part( 'template-parts/content', 'none' );
    
    endif;
    ?>

    0 0

    I am currently installing schema code into the image tags and I am running into some trouble.

    I have got to a point where I can get the width and height to display correctly for the main header image, but because I have related images at the bottom of the post, it puts the wrong image size in those image tags.

    Is there a better way to do this? Any help is much appreciated.

    /* adds the schema width and height for image */
    function add_opening_span_before_img_tags_with_schema(){
    add_filter('post_thumbnail_html','add_big_beginning_to_thumbnail');
    function add_big_beginning_to_thumbnail($thumb) {
    $image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "entry-thumbnail cherry-thumb-l aligncenter large" );
    $image_width = $image_data[1];
    $image_height = $image_data[2];
    $feat_image_url = wp_get_attachment_url( get_post_thumbnail_id() );
    $thumb = str_replace('<img', '<span itemprop="image" itemscope itemtype="https://schema.org/ImageObject"><meta itemprop="width" content="' . $image_width . '" ><meta itemprop="height" content="' . $image_height . '"><meta itemprop="url" content="' . $feat_image_url . '"><img', $thumb);
    return $thumb;
    }
    }

    I am currently editing my functions.php file to get schema to be inserted into the various relevant sections of my page. And one of the sections is the <img> tag. on the blog post pages the header image at the top displays and I insert the schema into that <img> tag using the above code. But on that page I also have the relevant content images at the bottom of the post. The code above seems to be inserting the main image width and height schema into the relevant article images width and height as well. I think I am targeting the wrong function.


    0 0

    Dear bcworkz,

    The following "wp_redirect" i found in my function.php

    <?php
    add_action(‘template_redirect’, ‘bwp_template_redirect’);
    function bwp_template_redirect()
    {
    if (is_author())
    {
    wp_redirect( home_url() ); exit;
    }
    }
    
    function author_archive_redirect() {
       if( is_author() ) {
           wp_redirect( home_url(), 301 );
           exit;
       }
    }
    add_action( 'template_redirect', 'author_archive_redirect' );
    
    /*remove wordpress version number from front-end pages*/
    function remove_version_from_mysite() {
      return '';
    }
    add_filter('the_generator','remove_version_from_mysite');
    add_filter('generator','remove_version_from_mysite');
    ?>
    // go to region home page if a home page request from same site
    // region determined from referrer URL
    add_action('init', 'tg_home_by_region');
    function tg_home_by_region( $query ) {
      if ( array_key_exists('HTTP_REFERER', $_SERVER ) && 0 === strpos( $_SERVER['HTTP_REFERER'], site_url('/'))) {
        $explode = explode('/', $_SERVER['HTTP_REFERER']);
        $region = $explode[3];
        if ( "/$region/" != $_SERVER['REQUEST_URI'] && '/' == $_SERVER['REQUEST_URI']) {
          wp_redirect( site_url("/$region/"));
          exit;
        }
      }
    }

    the following is in my htaccess file

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteRule ^*****/?$ /wp-login.php [QSA,L]
    RewriteRule ^*****/register/?$ /wp-login.php?action=register [QSA,L]
    RewriteRule ^*****/lostpassword/?$ /wp-login.php?action=lostpassword [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    RewriteCond %{REQUEST_URI} !^/wp-content/plugins/file/to/exclude\.php
    RewriteCond %{REQUEST_URI} !^/wp-content/plugins/directory/to/exclude/
    RewriteRule wp-content/plugins/(.*\.php)$ - [R=404,L]
    RewriteCond %{REQUEST_URI} !^/wp-content/themes/file/to/exclude\.php
    RewriteCond %{REQUEST_URI} !^/wp-content/themes/directory/to/exclude/
    RewriteRule wp-content/themes/(.*\.php)$ - [R=404,L]

    0 0
  • 08/31/16--04:54: mynde on "JS in main page"
  • Hello community im really stuck with this thing , maby you can help me out.
    I'm trying to add a small piece of java script from this project - http://introjs.com/ to main main page that is running on buddypress , i was trying to add it in my header.php , index.php and so on , but no luck so far, as you can allready tell im a total beginner. this is the code that i need to add

    <script type="text/javascript">
    $(function(){
      var introguide = introJs();
      // var startbtn   = $('#startdemotour');
    
      introguide.setOptions({
        steps: [
        {
          element: '.nav-bar',
          intro: 'This guided tour will explain the Hongkiat demo page interface.<br><br>Use the arrow keys for navigation or hit ESC to exit the tour immediately.',
          position: 'bottom'
        },
        {
          element: '.nav-logo',
          intro: 'Click this main logo to view a list of all Hongkiat demos.',
          position: 'bottom'
        },
        {
          element: '.nav-title',
          intro: 'Hover over each title to display a longer description.',
          position: 'bottom'
        },
        {
          element: '.readtutorial a',
          intro: 'Click this orange button to view the tutorial article in a new tab.',
          position: 'right'
        },
        {
          element: '.nav-menu',
          intro: "Each demo will link to the previous & next entries.",
          position: 'bottom'
        }
        ]
      });
    
      introguide.start();
    
    });
    </script>

    where should i put this? , P.s my website is http://l2adr.com


    0 0

    I have a company post type and a rounds table. The rounds table contains data about how much money each company raised and in how many rounds.
    The user can basically add and remove how many rounds that he want.
    A round looks like this -
    Round - 1, Amount - $100,000, date-'2016-08-31'.

    When the user hits save/update on the post I first delete all of the rounds and then add them again. Since I don't know if this is an update or an insert.
    Besides security can you please tell me if I'm doing it right? Is there a way maybe to insert them all in one query?
    I'm just used to ORM's and this is my first time writing plain SQL queries.

    Here is the code:

    global $wpdb;
    
    $amount_raised = $_POST["amount_raised"];
    $round_number  = $_POST["round_number"];
    $raised_date   = $_POST["raised_date"];
    
    //I can pick either field and the count will always be the same.
    $count = count( $amount_raised );
    $table_name = $wpdb->prefix . 'rounds';
    
    $wpdb->query( "DELETE FROM $table_name WHERE post_id = $post_id" );
    
    for ( $i = 0; $i < $count; $i++ )
    {
    	$wpdb->query( "
    		INSERT INTO $table_name (post_id, amount_raised, round_number, raised_date)
    		VALUES ('$post_id', '$amount_raised[$i]', '$round_number[$i]', '$raised_date[$i]')
    	" );
    }

    0 0

    Hello!
    I'm trying to add a sidebar to my archive pages, but only the archive pages for my custom post type 'teachings', and for the custom taxonomy pages that are correlated with that post type. I want to leave all the other pages and archives where a sidebar could go untouched, but I'm having a lot of difficulty.

    The best solution I could come up with was downloading a plugin that allows you to add sidebars to pages by shortcode (the one I ended up using is Stag Custom Sidebars), then adding that to the archive pages using my child theme's functions.php file. So, I entered this:

    add_action( 'pre_get_posts', 'filter_sidebar' );
    function filter_sidebar(){
    	if( is_post_type_archive('teachings') ) {
    		echo do_shortcode( '[stag_sidebar id='filter']' );
    	}
    }

    but every time i apply this it breaks my site. I can't figure out what I'm doing wrong...

    The reason I want to use my child theme's functions.php is to avoid problems with updates to my theme in the future.

    Maybe there's a better way to go about this. Any suggestions would be greatly appreciated.
    Thank you so much for taking the time to read my question, and thank you in advance for your help!


    0 0

    Or are the browsers just too clever now, and they don't show the obfuscated code?

    Here's what I've got:

    function display_my_email() {
            return '<strong>' . antispambot( 'support@example.com' ) . '</strong>';
    }
    add_shortcode( 'display_my_email', 'display_my_email' );

    I found a post that mentioned the Chrome dev tools will not show the scrambled version, so I did a view source in both Chrome and Firefox, and the email is plaintext, not encoded at all. Am I missing something here?

    EDIT: you can see it in action near the top of the page: https://ewww.io/contact-us/


    0 0

    Hi,

    I want to upload files to an additional upload folder. All files with 'canada' in their name.

    I use upload_dir to create a custom upload folder:

    function custom_upload_dir( $custom_dir ) {
    	$dir = WP_CONTENT_DIR . '/userfiles';
    	$url = WP_CONTENT_URL . '/userfiles';
    
    	$bdir = $dir;
    	$burl = $url;
    
    	$custom_dir = array(
    		'path'    => $dir,
    		'url'     => $url,
    		'basedir' => $bdir,
    		'baseurl' => $burl,
    		'error'   => false,
    	);
    	return $custom_dir;
    }
    add_filter( 'upload_dir', 'custom_upload_dir' );

    Now all uploaded files are listed in the userfiles directory.

    So I thought including this does the trick:

    $mystring = $_SERVER["REQUEST_URI"];
    $findme = 'canada';
    $pos = strpos($mystring, $findme);
    
    if ($pos === true) {

    But no!

    I notice this in codex:

    Using this, in conjunction with the wp_handle_upload_prefilter, you can dynamically determine which directory to upload to, based on the files you upload.

    But, how can I do that?

    Guido