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 | .... | 384 | 385 | (Page 386) | 387 | 388 | .... | 413 | newer

    0 0

    In my index.php, I have

    <?php
                if(have_posts()) :
                    while(have_posts()) : the_post();
                        echo cool_post_article_normal_block();
                    endwhile;
                endif;
    ?>

    So in funcitons cool_post_article_normal_block() says...

    link -> http://pastebin.com/WDDJC6ks

    What I understand is that I'm supposed to modify between <article></article>but what I don't know how to do is get the post format conditionally; especially since there is already a sticky conditional-- and I don't know PHP well :(

    I'm very new to PHP so I'm unsure how to do this. I have several post formats activated: quote, video, gallery, audio, image.

    I'd like the loop to go something like:

    if sticky
    if quote
     show title only
    if video, audio, gallery
     show title
     show excerpt
    if image
     show title
     show featured image
    else
    if quote
     show title only
    if video, audio, gallery
     show title
     show excerpt
    if image
     show title
     show featured image

    0 0

    What class/file should I install the function and add_filter() call in order to intercept the post request?

    I've tried a number of areas, some don't get called at all, others don't have the data that I'm looking for (xmlrpc.php).

    Does there also need to be a call to apply_filters(), before the function will be called? The problem I'm running into is that I don't think that the _insert_post() function of class-wp-xmlrpc-server.php is ever called which is the only place that I've found an apply_filters() call for 'xmlrpc_wp_insert_post_data'.

    I'd appreciate any thoughts or suggestions because as it stands right now I'm just chasing my tail.

    Thanks
    Andy


    0 0

    Hi, I want to auto run our backup scripts before plugin/core or any update happens, either auto or manually.
    What triggers when WP is updating?
    Thanks


    0 0

    Hello,
    I'm currently using a function inside my Functions.php which adds featured image of a post/page etc...as the background image.

    function set_post_background() {
    	global $post;
    	$bgimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full");
    	if (!empty($bgimage)) {
    		return '<style type="text/css">body {background:#fff url('.$bgimage[0].') no-repeat top center;}</style>';
    	}
    }

    It works fine, but I don't always want the featured image to be the background image. Would it be possible to add a checkbox in the featured image page, which would enable/disable this function?

    I'm not great at php, so any help would be much appreciated!


    0 0

    Hello there,

    I am currently trying to figure out how to setup my footer and i am using static blocks to do it ( came with the theme ).

    What i am trying to do is add as a text block in the footer menu the following : <p><?php wp_loginout(); ?></p>

    Although it won't accept it or if it does it won't display the button on the front page.

    If i try to add that code as text widget it displays fine but is not in the place where i want it to be displayed which is in a column below the rest of the footer menu.

    Any one know how to add a function via static blocks?
    Thanks


    0 0

    Im using Listify with FacetWP plugin and I'd like to change the value of the homepage search button to put there call to action instead. But I can't locate the code to make this change. I was able to change the placeholder, but can't do that for the Search button. I looked for similar topics and couldn't really find anything except editing searchform.php file which didn't make any changes to me. Thanks for any help.
    Link to my site: calsolarcontractors.com


    0 0

    I'm working with wordpress and I'm creating a theme for myself. I want to use the wordpress media library in the admin panel. So after some searching I found this page: https://codex.wordpress.org/Javascript_Reference/wp.media

    There are multiple tutorials to add this media library with jQuery, but I would like to do it in a plain javascript way. I've no trouble converting the jQuery to javascript except this piece of code:

    // When an image is selected in the media frame...
        frame.on( 'select', function() {
            // Removed unrelevant code
      });

    Ive tried the following things:

    frame.select = function(){};
    frame.onselect = function(){};
    frame.addEventListener('select',function(){});

    None of them are working, I get an error on the last one:

    frame.addEventListener is not a function

    So I hope I can get some help from here. I love everyone trying to help, but I don't want to hear: "use jQuery". The choice for not using jQuery is one I made on purpose.

    StefanJanssen

    I also placed this question on StackOverflow a few days back:
    http://stackoverflow.com/questions/37240944/wordpress-media-library-in-plain-javascript
    I will keep both the sites up to date with the newest information.


    0 0

    Id like to change the behaviour of autocomplete filtering on my homepage. Id like to replace Update button with standard Search button with the same functionality as the Find Solar Companies in Your Area button. The only difference is I would like to take my visitors straight to the chosen contractor's listing page and not to the search results.

    Here is the link to my site: calsolarcontractors.com
    Here's the code for Autocomplete filtering:

    <?php
    
    class FacetWP_Facet_Autocomplete
    {
    
        function __construct() {
            $this->label = __( 'Autocomplete', 'fwp' );
    
            // ajax
            add_action( 'wp_ajax_facetwp_autocomplete_load', array( $this, 'ajax_load' ) );
            add_action( 'wp_ajax_nopriv_facetwp_autocomplete_load', array( $this, 'ajax_load' ) );
        }
    
        /**
         * Generate the facet HTML
         */
        function render( $params ) {
    
            $output = '';
            $value = (array) $params['selected_values'];
            $value = empty( $value ) ? '' : stripslashes( $value[0] );
            $output .= '<input type="search" class="facetwp-autocomplete" value="" placeholder="' . __( 'Already Have One in Mind? Check Their Stats', 'fwp' ) . '" />';
            $output .= '<input type="button" class="facetwp-autocomplete-update update-hide" value="' . __( 'Update', 'fwp' ) . '" />';
            return $output;
        }
    
        /**
         * Filter the query based on selected values
         */
        function filter_posts( $params ) {
            global $wpdb;
    
            $facet = $params['facet'];
            $selected_values = $params['selected_values'];
            $selected_values = is_array( $selected_values ) ? $selected_values[0] : $selected_values;
            $selected_values = stripslashes( $selected_values );
    
            if ( empty( $selected_values ) ) {
                return 'continue';
            }
    
            $sql = "
            SELECT DISTINCT post_id FROM {$wpdb->prefix}facetwp_index
            WHERE facet_name = %s AND facet_display_value LIKE %s";
    
            return $wpdb->get_col(
                $wpdb->prepare( $sql, $facet['name'], '%' . $selected_values . '%' )
            );
        }
    
        /**
         * Output any admin scripts
         */
        function admin_scripts() {
    ?>
    <script>
    (function($) {
        wp.hooks.addAction('facetwp/load/autocomplete', function($this, obj) {
            $this.find('.facet-source').val(obj.source);
        });
    
        wp.hooks.addFilter('facetwp/save/autocomplete', function($this, obj) {
            obj['source'] = $this.find('.facet-source').val();
            return obj;
        });
    })(jQuery);
    </script>
    <?php
        }
    
        /**
         * Output any front-end scripts
         */
        function front_scripts() {
    
            $no_results = __( 'No results', 'fwp' );
    ?>
    <script src="<?php echo FACETWP_URL; ?>/assets/js/jquery-autocomplete/jquery.autocomplete.min.js?ver=<?php echo FACETWP_VERSION; ?>"></script>
    <link href="<?php echo FACETWP_URL; ?>/assets/js/jquery-autocomplete/jquery.autocomplete.css?ver=<?php echo FACETWP_VERSION; ?>" rel="stylesheet">
    <script>
    (function($) {
        wp.hooks.addAction('facetwp/refresh/autocomplete', function($this, facet_name) {
            var val = $this.find('.facetwp-autocomplete').val() || '';
            FWP.facets[facet_name] = val;
        });
    
        $(document).on('facetwp-loaded', function() {
            $('.facetwp-autocomplete').each(function() {
                var $this = $(this);
                $this.autocomplete({
                    serviceUrl: ajaxurl,
                    type: 'POST',
                    minChars: 3,
                    deferRequestBy: 200,
                    showNoSuggestionNotice: true,
                    noSuggestionNotice: '<?php echo esc_attr( $no_results ); ?>',
                    params: {
                        action: 'facetwp_autocomplete_load',
                        facet_name: $this.closest('.facetwp-facet').attr('data-name')
                    }
                });
            });
        });
    
        $(document).on('keyup', '.facetwp-autocomplete', function(e) {
            if (13 == e.which) {
                FWP.autoload();
            }
        });
    
        $(document).on('click', '.facetwp-autocomplete-update', function() {
            FWP.autoload();
        });
    })(jQuery);
    </script>
    <?php
        }
    
        /**
         * Load facet values via AJAX
         */
        function ajax_load() {
            global $wpdb;
    
            $query = esc_sql( $_POST['query'] );
            $facet_name = esc_sql( $_POST['facet_name'] );
    
            $sql = "
            SELECT DISTINCT facet_display_value
            FROM {$wpdb->prefix}facetwp_index
            WHERE facet_name = '$facet_name' AND facet_display_value LIKE '%$query%'
            ORDER BY facet_display_value ASC
            LIMIT 10";
            $results = $wpdb->get_results( $sql );
    
            $output = array();
            foreach ( $results as $result ) {
                $output[] = array(
                    'value' => $result->facet_display_value,
                    'data' => $result->facet_display_value,
                );
            }
    
            echo json_encode( array( 'suggestions' => $output ) );
            exit;
        }
    }

    0 0

    I am trying to get my website to start at the bottom and scroll up to give the effect that it is scrolling into the sky.

    Here are an example like the section of this site where the person goes up in the hot air balloon.
    http://www.rleonardi.com/interactive-resume/

    I tried to use the javascript from this link
    http://jsfiddle.net/5uutv/1/ but I could not get it to work on my website.

    I am using a custom template
    My website url is http://mariahbillings.com/

    Thank you. Any assistance with this matter would be much appreciated.


    0 0

    I want to show the title of the page with no links to the draft pages.
    this is my code

    <?php
    wp_list_pages( array(
    'title_li' => '',
    'child_of' => '4721',
    'post_status' => 'publish,draft'
    ) );
    ?>


    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

    Hello,
    Most of our users using the wrong setting for there new post. Their messages contains different pictures (20).

    I wonder if it is possible that we can changes 'AD MEDIA' to the option 'AD GALLERY'?

    Thanks
    JP


    0 0

    Hello,

    I have custom post type with field like this:
    home_club, away_club, is_finish.

    And I have problem when create head to head player, my filter too slow filter this:
    Select all mypost type where (home_club == "A" AND away_club == "B" AND is_finish == TRUE ) OR (home_club = "B" and away_club = "A" and is_finish = "TRUE")

    And my Code this:

    <?php
                                      $type = 'match';
                                      $args = array(
                                          'post_type' => $type,
                                          'posts_per_page' => '5',
                                          'post_status' => 'publish',
                                          'meta_query' => array(
                                              array(
                                                  'relation' => 'AND',
                                                  array(
                                                      'key' => 'home_club',
                                                      'value' => $home[1],
                                                      'compare' => '='
                                                  ),
                                                  array(
                                                      'key' => 'club_away',
                                                      'value' => $away[1],
                                                      'compare' => '='
                                                  ), array(
                                                      'key' => 'is_finish',
                                                      'value' => true,
                                                      'compare' => '='
                                                  )
                                              ),
                                              'relation' => 'OR',
                                              array(
                                                  'relation' => 'AND',
                                                  array(
                                                      'key' => 'home_club',
                                                      'value' => $away[1],
                                                      'compare' => '='
                                                  ),
                                                  array(
                                                      'key' => 'club_away',
                                                      'value' => $home[1],
                                                      'compare' => '='
                                                  ), array(
                                                      'key' => 'is_finish',
                                                      'value' => true,
                                                      'compare' => '='
                                                  )
                                              ),
                                          ),
                                          'orderby' => 'meta_value_num',
                                          'meta_key' => 'tanggal_main',
                                          'order' => 'desc',
                                      );

    0 0

    Hi.

    I have a verry basic question about codefile inclusion when it comes to PHP.
    Is it common to only include extra files, like the facebook api, only when they are needed?

    Simply put i encountered a problem where another plugin is importing an earlier version of the Facebook API and i'm trying to use a newer version. I've tried exploring different venues but the only conclusion i can come to is to rewrite the plugin i'm using slightly to only load the facebook API when it needs to use it.


    0 0

    Hello,

    I have a woocommerce site and I've been looking for plugins available for both word press or woocommerce that denies anybody under 18 to register. The age verification gate way plugins aren't really enough.

    I've looked for awhile and I can't find anything. So I'm assuming that it's a custom code that needs to be added to the registration form. Does anybody have any idea on how I'd start about doing this?


    0 0

    0
    down vote
    favorite
    I'm running a PHP script that pulls property listing data from a RETS server and inserts the listing date into the WordPress database directly with SQL queries. I'm not using any WordPress functions for this as i'm not very familiar with them and speed is very important to keep up with all the data.

    I have a custom post type called listings with a custom category/taxonomy called locations.

    The script creates the custom spots, creates and assigns taxonomies for locations. Examples of terms for 'locations' could be city names 'Miami','Aventura', zip codes and the names of buildings.

    When I go to to edit one of the 'listings' I can see that it shows the correct taxonomies selected.

    However when trying to view the list of 'listings' on a specific location/category, no listings/posts show and i get an error from my theme:

    Notice: Trying to get property of non-object in /path/wp-content/themes/Avada/includes/class-fusion-breadcrumbs.php on line 437
    This error shows twice and then:

    Catchable fatal error: Object of class WP_Error could not be converted to string in path/wp-content/themes/Avada/includes/class-fusion-breadcrumbs.php on line 618
    This is fixed by editing the custom location taxonomy from WP admin and just hitting Update, then the errors go away and the listings/posts are displayed.

    However i have over 4500 locations and will add more in the future. I can't seem to find any changes done to the database from before/after I hit Update on the custom location.

    Through +5 hours or reading it seems as WP has a global variable called $wp_taxonomies, but like I said I'm running a script from outside of WordPress to interact with it's database.

    How would I register these taxonomies completely or is there a way to 'mass' Update all the current taxonomies for 'locations'?


    0 0

    I am using this preg_replace code to change all imgur links on my site:

    add_filter('wp_insert_post_data', 'pm_add_memegen');
    function pm_add_memegen( $data ) {
       $data['post_content'] = preg_replace('/imgur.com\/(?!memegen\/create)/', 'imgur.com/memegen/create/', $data['post_content']);
       return $data;
    }

    But this also affects a Shortcode I have to use to display Imgur ablums which I do not want, because the shortcode will break.

    [wpws url="http://imgur.com/a/zaNdd/all" query=".posts"]

    Is there a way I can force the preg_replace code to ignore the shortcode and only affect the images displayed on my site?

    Thanks


    0 0

    Hello, my checkout page grayes out and when i add a product to cart it doubles the quantity.Using the Wp-debug i keep getting the following errors:
    Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts,

    admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in

    version 3.3.) in mypath/wp-includes/functions.php on line 3897

    Any help is appreciated
    Thanks in advance,
    czafir


    0 0

    I have two searches on my homepage. I would like to replace the bottom one(with the Find a Solar Company button) with SearchWP Live Ajax Search widget. Im using listify theme and wp job manager and when trying to customize my homepage, the searchWP Live Ajax Search goes underneath main header section. How can I place it over the cover image under the Find a Solar Company in Your Area button?
    Link to my site calsolarcontractors.com


    0 0

    Hi

    I need a mysql query to show all products by a category

    here is a example of something I need , but i have issues on my where clause
    any body know how to fix this ?
    
    SELECT wp_posts.* FROM wp_term_relationships
    LEFT JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID
    LEFT JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
    LEFT JOIN wp_terms ON wp_terms.term_id = wp_term_relationships.term_taxonomy_id
    WHERE post_type = ‘product’ AND taxonomy = ‘product_cat’
    where wp_term_taxonomy.term_taxonomy_id = 18

older | 1 | .... | 384 | 385 | (Page 386) | 387 | 388 | .... | 413 | newer