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

older | 1 | .... | 410 | 411 | (Page 412) | 413 | newer

    0 0

    Hello, I would like to learn how to change the default video player with something like flowplayer or JW player.

    I was thinking on removing the video shortcode handler and replacing it with my own function to wrap the url inside the custom player. Something like:

    remove_shortcode('video');
    add_shortcode('video', 'wrap_video_shortcode');

    Is there some other way?

    Also, could I have multiple players to choose from in the media embed dialog, the one with player, url, attachment page...

    Thanks!


    0 0

    How are so many theme authors making it possible to show menu links to show the different headers or blog styles and layouts from the same demo? I often see a theme demo with several menu links with the URL containing a ? in it like this example: /?home=masonry

    For example : http://solopine.com/sproutspoon/?home_layout=standard
    http://solopine.com/sproutspoon/?home_layout=grid3

    I'd like to start theme demos that can showcase the different layouts of a blog, different home page layouts, or the different header styles, different slider options.

    My header styles, blog layouts. and other options are selected from the WordPress Customizer, Everything is working fine, but how can i display them in url to the user as my theme demo.


    0 0

    I've been using this WP plugin boilerplate for some time and now I have a problem that I can't seem to solve, so I would appreciate any help.

    Here's my main plugin file called rs-license.php:
    http://pastebin.com/yF5nRH3A

    In includes there's a file called class-plugin-name-activator.php and in it there's a class called Plugin_Name_Activator and a public static function called activate.

    Here's includes/class-rs-license-activator.php file:
    http://pastebin.com/E09DATph

    As far as codex says for wp_schedule_event, I need to add an action, something along the lines of this:
    add_action( 'rs_license_check_for_expiring_license', 'rs_license_do_check_for_expiring_license' );

    However, I have no idea where to put nor how it should be called in order for everything to work properly. Can anyone help?


    0 0

    Users sign up for a hike, and their sign-up info is captured into a table called wp-cf7dbplugin_submits. When the user signs up, I want to be able to query the table to determine if they have already signed up or not, so I don't end up with duplicate entries.

    I am brand new to SQL, so any/all advice greatly appreciated.

    My table is called wp_cf7dbplugin_submits
    Fields are:
    form_name to use is Hike_Sign_Up_Form
    field_name to use is name_of_hike
    a second field_name to use is hiker_name
    field_value contains the actual data

    ie:
    form_name
    Hike_Sign_Up_Form

    field_name
    name_of_hike
    hiker_name

    field_value
    AZT - South from Picketpost (S) - 7 Dec 2016
    MinnieMouse

    Here's what I have so far:

    $meta_query_args = array(
    		array(
    		'relation' => 'AND',
    		array(
    			'key'     => 'name_of_hike',
    			'value'   => 'AZT - South from Picketpost (S) - 7 Dec 2016',
    			'compare' => '='
    		),
    		array(
    			'key'     => 'hiker_name',
    			'value'   => 'MinnieMouse',
    			'compare' => '='
    		)
    	)
    );

    This runs w/out error. However, I have no clue how to actually determine if this resulted in a TRUE or FALSE (did the hiker name - name of hike combo already exist?)

    If I am completely off base - please point me in the right direction. If I could create a filter to capture and check this when user clicks "SUBMIT", so I can kick back an error to them if this is a duplicate sign up, that would be ideal.

    Thanks in advance.


    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]

older | 1 | .... | 410 | 411 | (Page 412) | 413 | newer