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

    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

    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

    https://wordpress.org/support/topic/warning-this-plugin-will-hack-brick-your-site covers a recent problem where a plugin overwrites wp-includes/plugin.php + Bricks sites.

    My question is about writing a plugin to catch + block this sort of nonsense.

    I private host 100s of high traffic WordPress client sites, so if one of my clients accidentally had installed this plugin their site would have been down, till I could duplicate + debug this problem. An unacceptable solution for sites generating $1000s/hour in profit.

    My question relates to where to find example code which might give me implementation clues.

    Logic to implement seems to follow this flow + applies to theme + plugin installation:

    1) Hook http_request_args

    a) If an install initiates related to known offending code, return an error with detail about why installation failed.

    b) If an install initiates related to know good code, say the Twenty Sixteen theme, skip additional logic.

    2) Hook WP_Filesystem for any non-whitelisted installation + any attempt to overwrite core files or files in other random theme + plugin directories outside scope of current installation are attempted, return an error with detail about why installation failed.

    Also be nice to hook post_unzip_file, to scan file names + contents, before every starting the WP_Filesystem processing + there seems to be no easy way to hook directly after unzip_file runs.

    Suggestions + pointers to coding clues are appreciated.

    Thanks.


    0 0

    Hi,
    is it possible to change the domainname with add_rewrite_rule (or somehow else)?

    Initial situation:
    "www.myfirstdomain.com" and "www.myseconddomain.com" point to the same IP-Adress of my server.

    Requirement:
    Under certain conditions I just want to change the domain name which is shown in the browser , but without redirect.

    Is this possible?
    Thx


    0 0

    Hello!

    Could you please help me to understand - how I can change list of available translations on the plugin page in the repository?

    I have published plugin https://wordpress.org/plugins/popup4phone/ , in the /lang/ sub directory it contatins .po and .mo files for Russian and German translation.

    However translations list in the right column on the page https://wordpress.org/plugins/popup4phone/ contains only Russian translation, while German translation not appeared.


    0 0

    I'm looking for a hack to display custom taxonomies in the sidebar. I know there are quite a few plugins available for such but I was hoping to display only the top terms used for a certain taxonomy in the last say 90 days. Any help would be appreciated.


    0 0

    I keep seeing this error at the bottom of my site (i do have debugging on) its telling me to look at line 3658. and its fills most of my debug.log file. however when looking at that line, it looks like its just a message? is there a reason its still in? even without plugins installed i see the message so i dont think anything is using the deprecated get_user, do i need to do something to remove it or should i be worried about it causing any problems?

    thanks


    0 0

    Please help, I use Illdy theme which uses nice function/class for listing "Related Articles" under Posts. It is the file \themes\illdy\inc\components\related-posts\class.mt-related-posts.php

    However I would like to make it work for Pages as well. What do I need to change to make it work for Pages?

    The call is done with:
    do_action( 'mtl_single_after_content' );

    I tried changing
    wp_get_post_categories( $post->ID )
    to
    wp_get_post_categories( $page->ID )

    but then the loading times get very long.

    Here is the entire code of the function/class:

    /**
         * Class MTL_Related_Posts_Output
         *
         * This file does the social sharing handling for the Muscle Core Lite Framework
         *
         * @author		Cristian Raiber
         * @copyright	(c) Copyright by Macho Themes
         * @link		http://www.machothemes.com
         * @package 	Muscle Core Lite
         * @since		Version 1.0.0
         */
    
        // @todo : more effects for hover images
        // @todo: pull in more than post title & date
    
        if( !function_exists( 'MTL_CallRelatedPostsClass' ) ) {
        /**
         *
         * Gets called only if the "display related posts" option is checked
         * in the back-end
         *
         * @since   1.0.0
         *
         */
        function MTL_CallRelatedPostsClass()
        {
            $display_related_blog_posts = get_theme_mod('illdy_enable_related_blog_posts', 1);
    
            if ($display_related_blog_posts == 1) {
    
                // instantiate the class & load everything else
                MTL_Related_Posts_Output::getInstance();
            }
        }
        add_action( 'wp_loaded', 'MTL_CallRelatedPostsClass');
        }
    
        if( !class_exists( 'MTL_Related_Posts_Output' ) ) {
    
    	/**
    	 * Class MTL_Related_Posts_Output
    	 */
    	class MTL_Related_Posts_Output {
    
    		/**
    		 * @var Singleton The reference to *Singleton* instance of this class
    		 */
    		private static $instance;
    
    		/**
    		 *
    		 */
    		protected function __construct() {
    			add_action( 'mtl_single_after_content', array( $this, 'output_related_posts' ), 3 );
    		}
    
    		/**
    		 * Returns the *Singleton* instance of this class.
    		 *
    		 * @return Singleton The *Singleton* instance.
    		 */
    		public static function getInstance() {
    			if ( null === static::$instance ) {
    				static::$instance = new static();
    			}
    
    			return static::$instance;
    		}
    
    		/**
    		 * Private clone method to prevent cloning of the instance of the
    		 * *Singleton* instance.
    		 *
    		 * @return void
    		 */
    		private function __clone() {
    		}
    
    		/**
    		 * Private unserialize method to prevent unserializing of the *Singleton*
    		 * instance.
    		 *
    		 * @return void
    		 */
    		private function __wakeup() {
    		}
    
    		/**
    		 * Render related posts carousel
    		 *
    		 * @return string                    HTML markup to display related posts
    		 **/
    		function output_related_posts() {
    			global $post;
    
    			$output = '';
    
    			$post_query_args = array (
    				'post_type'					=> array( 'post' ),
    				'category__in'				=> wp_get_post_categories( $post->ID ),
    				'nopaging'					=> false,
    				'posts_per_page'			=> 3,
    				'ignore_sticky_posts'		=> true,
    				'cache_results'				=> true,
    				'update_post_meta_cache'	=> true,
    				'update_post_term_cache'	=> true,
    				'post__not_in'				=> array( $post->ID ),
    				'meta_key'					=> '_thumbnail_id'
    			);
    
    			$post_query = new WP_Query( $post_query_args );
    
    			if( $post_query->have_posts() ) {
    				$output .= '<div class="blog-post-related-articles">';
    					$output .= '<div class="row">';
    						$output .= '<div class="col-sm-12">';
    							$output .= '<div class="related-article-title">';
    								$output .= __( 'Related Articles', 'illdy' );
    							$output .= '</div><!--/.related-article-title-->';
    						$output .= '</div><!--/.col-sm-12-->';
    
    						while( $post_query->have_posts() ) {
    							$post_query->the_post();
    
    							$post_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'illdy-blog-post-related-articles' );
    
    							$output .= '<div class="col-sm-4">';
    								$output .= '<a href="'. esc_url( get_permalink() ) .'" title="'. esc_attr( get_the_title() ) .'" class="related-post" style="background-image: url('. ( $post_thumbnail ? esc_url( $post_thumbnail[0] ) : '' ) .');">';
    									$output .= '<span class="related-post-title">'. esc_html( get_the_title() ) .'</span>';
    								$output .= '</a><!--/.related-post-->';
    							$output .= '</div><!--/.col-sm-4-->';
    						}
    					$output .= '</div><!--/.row-->';
    				$output .= '</div><!--/.blog-post-related-articles-->';
    			}
    
    			wp_reset_postdata();
    
    			echo $output;
    		}
    	}
        }

    Thanks for reading and any helpful advice.


    0 0

    I don't have any error or issue I just wanted to know if I can make the wordpress login system in a post method so that the url does not change. Something like a ajax call to the server..

    I am using wp_login_form() function and created a nice login form but the ugly url creates a mess.


    0 0

    Hello,

    I wrote a plugin that uses WP_Query to display some posts, depending of the users choices. The query is made on taxonomies.
    It's working pretty well, but the only thing I'm not able to achieve is the order of the results.
    I'd like to sort the results by catagory names, but it's not working...
    In the args, here's what I wrote:

    'orderby' => 'category',
    'order' => 'asc',

    I don't understand what's wrong. Could anybody help me?
    Thanks


    0 0

    add_theme_support( 'custom-background' );
    
    add_action( 'customize_register', 'custom_background_size' );
    function custom_background_size( $wp_customize ) {
    
        $wp_customize->add_setting( 'default-size', array(
                'default' => 'inherit',
            ) );
    
        $wp_customize->add_control( 'default-size', array(
                'label'      => 'Background Image Size',
                'section'    => 'background_image',
                'settings'   => 'default-size',
                'priority'   => 200,
                'type' => 'radio',
                'choices' => array(
                    'cover' => 'Cover',
                    'contain' => 'Contain',
                    'inherit' => 'Inherit',
                )
            ));
    }
    add_action( 'wp_head', 'custom_background_size_css', 999 );
    function custom_background_size_css() {
    
        $background_size = get_theme_mod( 'default-size', 'inherit' );
    
        echo '<style type="text/css"> body.custom-background { background-size:'.$background_size.'; } </style>';
    
    }

    This is code i'm using that add custom background image to customizer (from codex) and additional size attribute.

    Now i want it to hide along other controls when image is not specified but can't find active_callback name for it.

    Also i would like to move whole custom background section to panel. Tried :

    add_theme_support( 'custom-background', $defaults );
    
    $defaults = array(
    	'panel' => 'theme_settings'
    );

    but that's not working. Any idea how can i get these 2 things work ?
    Thanks

    @up
    One more thing. How can i add section icons like in first screenshot here ?


    0 0

    I run a percussion instruction membership website. For each student, I give them a personalized "practice sheet" on the website that is updated automatically based on what exercise/tempo they mark as complete. Currently, here is how I am achieving this:

    - I have a master Google Sheets document that contains all of the exercises and formulas that create the "practice sheet" on a different sheet, and there is also a Google Form attached to it for submission.
    - When a member signs up through Paid Membership Pro, I have the "User Pages" add-on to create a page just for that user with some generic content.
    - I then go in and create a new Google Sheet/Form from the master and then embed their unique form and practice sheet onto their user page so that they can submit the exercise/tempo and it will automatically show on the practice sheet on the same page once it is submitted.

    Obviously this is not a sustainable practice if I want the website to grow.
    I'm just looking for some general ideas of how I could use the database in Wordpress instead of Google Sheets, and also how I could create just one page that all members would go to and it would only show their information. Any thoughts would be greatly appreciated!


    0 0

    Just updated all my plugins.

    I have a WooCommerce One Page Checkout set up for donations.

    Pre-upgrade:
    The Quantity box and Add To Order Button were hidden until you chose a donation amount.

    Post-upgrade:
    The Quantity box and Add To Order Button are visible before choosing a donation amount.

    I would like it to be hidden as it was before upgrading so the only thing you see is DONATION AMOUNT drop down box.

    Here is a link to the page as it is now:

    Here is a link to a screenshot of what it looked like before upgrading the WooCommerce plugin.

    What do I need to do to get this behaving like it was pre-upgrade?


    0 0

    'http://lehienduc02.blogspot.com/2012/09/oi-loi-voi-gia-inh-ang-bich-phuong.html


    0 0

    I have been trying to see how I can implement a feature on my site where an image can be scrolled on top of another image on mouse over. An example link is found below:
    http://paulnasr.com/beforeafterpics/before_and_after#content

    Will appreciate your response.

    Thanks


    0 0

    Is get_term_by actually a correct function ?

    E.g.:

    get_term_by('name','book','category')

    works as long as you only have one category in there with the name book, but if you have \bla\book and \def\dof\book also, it will just be random which one it will output.

    So instead of the get_term_by query:

    $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE $_field = %s", $value ) . " $tax_clause LIMIT 1" );

    Maybe it should check if there are multiple returned then also return multiple in all cases, I think LIMIT 1 should be removed, otherwise you can never check if multiple exist.

    $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE $_field = %s", $value ) . " $tax_clause " );

    So you cant use 'name', otherwise you would need to do something like:

    $categorychildren = get_term_children(config::getRootTermId(), 'category');
    			foreach($categorychildren as $wp_category_id) {
    				$cat_object = get_term($wp_category_id, 'category');
    				if ($cat_object->name == $whatwelookfor) {
    					// .. do the rest
    				}
    			}

    0 0

    Hi. I am using a plugin called "Oxford Debates."

    I think this question might be general coding, though. In one of the plugin's input fields I would like to add some html - really just some well-placed [br /] codes. (Brackets instead of <> so it will display here instead of execute.)

    I have found a part of the plugin code for sanitizing inputs. I commented out the relevant sanitize_text_area but that did not help.

    Any ideas?

    THANK YOU!!

    // Checks for input and sanitizes/saves if needed
    if( isset( $_POST[ 'titlepa-text' ] ) ) {
    	update_post_meta( $post_id, 'titlepa-text', sanitize_text_field( $_POST[ 'titlepa-text' ] ) );
    	//update_post_meta( $post_id, 'textpa-text', sanitize_text_field( $_POST[ 'textpa-text' ] ) );
    	update_post_meta( $post_id, 'titlepb-text', sanitize_text_field( $_POST[ 'titlepb-text' ] ) );
    	//update_post_meta( $post_id, 'textpb-text', sanitize_text_field( $_POST[ 'textpb-text' ] ) );
    	update_post_meta( $post_id, 'duration-check', sanitize_text_field( $_POST[ 'duration-check' ] ) );
    	update_post_meta( $post_id, 'initduration-text', sanitize_text_field( $_POST[ 'initduration-text' ] ) );
    	update_post_meta( $post_id, 'endduration-text', sanitize_text_field( $_POST[ 'endduration-text' ] ) );
    	update_post_meta( $post_id, "usera", $_POST["usera"]);
    	update_post_meta( $post_id, "userb", $_POST["userb"]);
    	update_post_meta( $post_id, "votea", $_POST["votea"]);
    	update_post_meta( $post_id, "voteb", $_POST["voteb"]);
    }

    0 0

    hello,
    i want to call a function every x minute(s) in my plugin automatically. how i do it?
    i see wp_schedule_event() , but it run every 1 hour/12 hours and 24 hours
    i want to run every 10 minutes for example.

    thanks


    0 0

    I'm writing a plugin more for a convenient way of writing some test pages. I've not really done much with Wordpress at all, more experimenting with PHP, so appologies if this is in the manual somewhere.
    One thing I've noticed on the page output - is there seems to be a spurious
    <p>Should be the tracker here…
    It seems to move around the source and I don't understand what is generating it. I've tried searching for it and not found anything, so any hints would be gratefully accepted.


older | 1 | .... | 382 | 383 | (Page 384) | 385 | 386 | .... | 413 | newer