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


Showcase


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 334 | 335 | (Page 336) | 337 | 338 | .... | 413 | newer

    0 0

    I'm not fluent in code. I've tried to figure this out on my own and just can't. Can someone please piece this together for me??

    I need to hide the Floating Social Media Links widget only on the theme's microsite template.

    I found a year-old post where the plugin author said there isn't a way to do this aside from editing php, but didn't give the php code to use.

    From the read-me file:

    If you are, siply copy this code: <?php floating_social_media_links() ?> and paste it into each template file that is used for the pages that you want [the widget to appear]

    But I don't want to edit every single page type. I just want to stick one piece of code into the microsite page template php file.

    Could someone please help? Thank you in advance!


    0 0

    I've noticed that various places in the media admin UI display an attachment's filesize.

    The procedure for getting the value seems to be something like this:

    $meta = wp_get_attachment_metadata( $post->ID );
    $file  = get_attached_file( $post->ID );
    $file_size = false;
    
    if ( isset( $meta['filesize'] ) )
    	$file_size = $meta['filesize'];
    elseif ( file_exists( $file ) )
    	$file_size = filesize( $file );

    That's all well and good, but in browsing through a number of WP databases, I'm yet to encounter a situation where filesize actually appears in _wp_attachment_metadata.

    Is storing the filesize in _wp_attachment_metadata something that's now deprecated? Something waiting to be implemented? Neither?

    I'm interested in storing this data so that I can retrieve a list of media posts ordered by their filesize. Since _wp_attachment_metadata is a serialized array it's not actually a great thing to try and use for sorting a post query, but regardless... can/should I try and implement something in my plugin to store 'filesize' here, or should that be avoided?


    0 0

    I'm using a plugin that comes from a self-hosted site which pushes the plugin update information via the plugins_api filter.

    Since WP 4.4. a new update results in renaming the directory. Previously this was (example) : '/my-plugin/plugin.php', but now some sort of hash is added, which results in something like '/my-plugin-IB4Ya7/plugin.php' .

    The latter part of the name is random and changes every update. I pushed the same update multiple times and every time it's a different string ( same length and composition though ).

    I'm browsing the source to figure out what's causing this and why. While annoying it provides no direct problems but I would like to understand if this is a bug or a feature.

    Anybody can give me some pointers to this, or have seen this happen on other (commercial) plugins? The plugins coming from WordPress.org repository don't have this behavior.

    I maintain the site where the plugin comes from as well. I've checked the information it pushes but it's up to documentation ( the little there is ), and this doesn't happen in WP 4.3 with the same update and code.


    0 0

    Hi,

    I'm looking for a way to remove theme settings from database when uninstalling theme.

    For plugin it's available. But it seems it still is not for themes?

    Who has a workaround / solution for this?

    I wish you all a very nice couple of days!

    Guido


    0 0

    Hi All,

    I am running the Spectra theme locally, and have section using Visual Composer shortcodes to add details to music album portfolio, such as the Music Label, Release Year, Catalog Number, etc.

    However I would like to perform a bulk upload of albums from a CSV file, and to do this I am thinking of adding custom field to the shortcodes. I have tried a few ways but they seem to come up blank; the code is as follow, and I want to replace the $label and $value with custom fields;

    // List
    function spectra_details_list( $atts, $content = null ) {
    
        return '<ul class="details-list">' . do_shortcode($content) . '';
    
    }
    add_shortcode( 'details_list', 'spectra_details_list' );
    
    // Detail
    function spectra_detail( $atts, $content = null ) {
    
        extract(shortcode_atts(array(
            'label' => 'Color',
            'value' => 'White'
        ), $atts));
    
        return '
    
    <li><span>' . $label . '</span>' . $value . '</li>
    ';
    
    }
    add_shortcode( 'detail', 'spectra_detail' );

    How can I do this? Any suggestions welcomed, thanks.


    0 0

    I've been reading about wp-enqueue and used their example and modified it to my own..
    (This is in my Plugin.php)

    /**
     * Proper way to register and enqueue scripts and styles
     */
    function stepline_stylesheets() {
        wp_register_style( 'stepline-min',  get_template_directory_uri() .'/css/Stepline.min.css', array(), null, 'all' );
        wp_register_style( 'stepline-css',  get_template_directory_uri() .'/css/style.css', array(), null, 'all' );
        wp_enqueue_style( 'stepline-min' );
        wp_enqueue_style( 'stepline-css' );
    }
    add_action( 'wp_enqueue_scripts', 'stepline_stylesheets' );

    For some reason, this isn't working? I've been confused for a while now.


    0 0

    Hello everyone!

    I am working on a shopping cart WordPress site and I would like to customize the subcategory page. Here is a link to my shopping cart. When you click on that link you see only the product category images. Originally, you saw both the image and title, but that's not how I wanted it to be so I edited the content-product_cat.php file. When you click on the Product Category it takes you to all the products that pertain to that category and is displayed the same way the product categories are - just the image. However, I want it to only display the titles, no images, just the titles. I understand that it's just showing the images because it's also using the content-product_cat.php file.

    How can I make it so that only the product category shows images but the actual products show just the titles?

    Here is an example of what I want my site to do.

    Please, any help is appreciated! I am new to building eCommerce and WordPress sites so the more specific you are, the better. Any help is appreciated!


    0 0

    So I'm trying to make related posts on my website more random, atm. it shows almost same posts on every other post. I'm pretty sure it's about orderby arg but i'm not sure how to implement that.

    Code i'm using for it:

    if(!function_exists('cherry_related_posts')){
    		function cherry_related_posts($args = array()){
    			global $post;
    			$default = array(
    				'post_type' => get_post_type($post),
    				'class' => 'related-posts',
    				'class_list' => 'related-posts_list',
    				'class_list_item' => 'related-posts_item',
    				'display_title' => true,
    				'display_link' => true,
    				'display_thumbnail' => true,
    				'width_thumbnail' => 250,
    				'height_thumbnail' => 150,
    				'before_title' => '<h3 class="related-posts_h">',
    				'after_title' => '</h3>',
    				'posts_count' => 14
    			);
    			extract(array_merge($default, $args));
    
    			$post_tags = wp_get_post_terms($post->ID, $post_type.'_tag', array("fields" => "slugs"));
    			$tags_type = $post_type=='post' ? 'tag' : $post_type.'_tag' ;
    			$suppress_filters = get_option('suppress_filters');// WPML filter
    			$blog_related = apply_filters( 'cherry_text_translate', of_get_option('blog_related'), 'blog_related' );
    			if ($post_tags && !is_wp_error($post_tags)) {
    				$args = array(
    					"$tags_type" => implode(',', $post_tags),
    					'post_status' => 'publish',
    					'posts_per_page' => $posts_count,
    					'ignore_sticky_posts' => 1,
    					'post__not_in' => array($post->ID),
    					'post_type' => $post_type,
    					'suppress_filters' => $suppress_filters
    					);
    				query_posts($args);
    				if ( have_posts() ) {
    					$output = '<div class="'.$class.'">';
    					$output .= $display_title ? $before_title.$blog_related.$after_title : '' ;
    					$output .= '<ul class="'.$class_list.' clearfix">';
    					while( have_posts() ) {
    						the_post();
    						$thumb   = has_post_thumbnail() ? get_post_thumbnail_id() : PARENT_URL.'/images/empty_thumb.gif';
    						$blank_img = stripos($thumb, 'empty_thumb.gif');
    						$img_url = $blank_img ? $thumb : wp_get_attachment_url( $thumb,'full');
    						$image   = $blank_img ? $thumb : aq_resize($img_url, $width_thumbnail, $height_thumbnail, true) or $img_url;
    
    						$output .= '<li class="'.$class_list_item.'">';
    						$output .= $display_thumbnail ? '<figure class="thumbnail featured-thumbnail"><a href="'.get_permalink().'" title="'.get_the_title().'"><img data-src="'.$image.'" alt="'.get_the_title().'" /></a></figure>': '' ;
    						$output .= $display_link ? '<a href="'.get_permalink().'" >'.get_the_title().'</a>': '' ;
    						$output .= '</li>';
    					}
    					$output .= '</ul></div>';
    					echo $output;
    				}
    				wp_reset_query();
    			}
    		}
    	}

    i have tried changing line:
    $post_tags = wp_get_post_terms($post->ID, $post_type.'_tag', array("fields" => "slugs"));
    to
    $post_tags = wp_get_post_terms($post->ID, $post_type.'_tag', array("fields" => "slugs", "orderby" => "rand"));
    but nothing changed.

    Any help with that?


    0 0

    hi there I am trying to switch between two datbase. I am using

    $wpdb->select('databasename');
    wp_cache_flush();

    however I am not getting any information and the theme is gone and only the text shows on this site.

    So I am stuck rigt now


    0 0

    I tried to post this elsewhere on the Wordpress forums, I think that broke some rules again. Mercy!

    What is the latest, best solution to get recent posts from across a multisite network on your central home page?

    The network-latest-posts plugin is not a solution; it requires you give it blog ID's from the blogs in your network.

    I am looking for an aggregator that automatically collects the latest posts from dozens, maybe hundreds of sites, without killing the server.

    The solution should probably use wp_get_sites() + get_last_updated().

    This proof-of-concept snippet is floating around:

    <?
    $blogs = get_last_updated();
    echo '
    <h1>Last posts in network</h1>
    ';
    foreach ($blogs AS $blog) {
    echo "
    <h2>".$blog["domain"].$blog["path"]."</h2>
    ";
    switch_to_blog($blog["blog_id"]);
    $lastposts = get_posts('numberposts=1');
    foreach($lastposts as $post) :
    setup_postdata($post);
    the_title();
    endforeach;
    restore_current_blog();
    }
    ?>
    `

    This post from 2011 has some kind of solution, but it is producing an annoying syntax error and I can't figure out how to fix it:

    http://www.smashingmagazine.com/2011/11/wordpress-multisite-practical-functions-methods/

    So what is the latest? Has anyone else worked on this? Can someone put this together, point me in the right direction?

    I have another old multisite network latest posts aggregator script that I could post, but it looks very messy.


    0 0

    Hi there.

    I'm just in learning how to create an own plugin and for the basics i'm fine.

    But how can i draw a chart "on the fly" in my plugin code?

    I tried with $mein_bild = ImageCreate (300, 150); and so on but this brings only some strange characters on my screen.
    Putting a header ("Content-type: image/png"); before like described in the most php-tutorials raises an error.

    Isn't it so simple as hoped?

    Thanks in advance

    Kai


    0 0

    Hello,

    Wordpress tag cloud in the widget is not showing properly after updating to wordpress 4.4. Earlier I used to customize "tagcloud" UL class but since wordpress 4.4 "tagcloud" class got changed to "wp-tag-cloud" and hence my CSS formatting is not working.

    The Title for tag cloud is also not showing up since wordpress 4.4 update.

    Please help me to resolve the issue. Which class should I use now?

    Please check out my website footer to have a look at the tagcloud issue http://techsini.com


    0 0

    Is this a ligit file? Go Daddy site lock is marking it as supicious.


    0 0

    Hi...

    I am have a page (category).

    My category slug (category).

    I'll using a few custom post type (shop,book,color).

    My permalinks:
    1- Working

    ..../shop/category/catname/postname
    ..../book/category/catname/postname
    ..../color/category/catname/postname

    2- Working

    ..../shop/category/catname
    ..../book/category/catname
    ..../color/category/catname

    and i am have a fake page (category).

    ..../category

    but i am need, if click
    ..../shop/category
    or
    ..../book/category
    or
    ..../color/category

    redirect "not [R], just in background": ..../category but it redirect with [R].


    0 0

    Hi all,

    New to modifying the function.php file and know only basic php. Below is my function.php file. Dreamweaver says there is an error at the last line, i.e. add_filter("mce_buttons_3", "enable_more_buttons”);

    Thanks,
    Greg

    <?php
    //// Recommended way to include parent theme styles.//
    ///(Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)//
    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

    //Your code goes below//

    function enable_more_buttons($buttons) {

    $buttons[] = 'fontselect';
    $buttons[] = 'fontsizeselect';
    $buttons[] = 'styleselect';
    $buttons[] = 'backcolor';
    $buttons[] = 'newdocument';
    $buttons[] = 'cut';
    $buttons[] = 'copy';
    $buttons[] = 'charmap';
    $buttons[] = 'hr';
    $buttons[] = 'visualaid';

    return $buttons;
    }
    add_filter("mce_buttons_3", "enable_more_buttons”);


    0 0

    I'm trying to write an if else statement for a Woocommerce template page that does this:

    if category is not a subcategory then:
    do_action( 'woocommerce_before_subcategory_title', $category );

    else show this:

    <h3>
        <?php
            echo $category->name;
    
            if ( $category->count > 0 )
                echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category );
        ?>
    </h3>

    So far I have a very primitive function that is no where near what the end product will be.

    Your help is greatly appreciated!


    0 0

    I am trying to implement a register form where I have a role selection radio button with choices"Role1" & "Role2" and other form elements

    It doesn't update the role for the registered user. It just adds None to the role after the registration is complete, but in essence I need the role which was selected to be saved when saving the username and other fields.

    Here is what I have so far -

    I have a registration form with fields which has radio choices like -

    <label>
         <input type="radio" name="user_role" id="Role1<?php $template->the_instance(); ?>_r" class="input"
         <?php if (isset($_POST['user_role']) && $_POST['user_role'] == 'Role1' ) echo 'checked="checked"'; ?> value="Role1"/>Role1
    </label>
    <label>
         <input type="radio" name="user_role" id="Role2<?php $template->the_instance(); ?>" class="input"
         <?php if (isset($_POST['user_role']) && $_POST['user_role'] == 'Role2' ) echo 'checked="checked"'; ?> value="Role2"/>Role2
    </label>

    This is what I have in another page that will process the incoming data.
    The error module works fine, ie. It only shows the error message when I am not checking any role in my registration page.

    <?php
    function tml_registration_errors( $errors ) {
    	if ( !isset( $_POST['user_role'] ) )
            $errors->add('empty_user_role', '<strong>ERROR</strong>: Please select a role.');
        return $errors;
    }
    add_filter( 'registration_errors', 'tml_registration_errors' );

    Saving module below doesn't take effect and I am having issues. For debugging purpose I have the alert setup but that doesn't alert show the alert box either, it is just bypassed and "None" is added to the role column in the dashboard view of user list.

    function tml_user_register( $user_id ) {
        $user = new WP_User( $user_id );
    
        if ($_POST['user_role'] = 'Role1'){
            echo "<script>alert('" . $_POST['user_role'] . "');</script>";
            $user->remove_role( 'Default Role' );
            $user->set_role( 'Role1' );
            update_user_meta( $user_id, 'role', $_POST['user_role'] );
    	unset( $user );
       }else{
            echo "<script>alert('" . $_POST['user_role'] . "');</script>";
            $user->remove_role( 'Default Role' );
            $user->add_role( 'Role1' );
            $user->set_role( $_POST['user_role'] ) ;
            update_user_meta( $user_id, 'role', $_POST['user_role'] );
    	unset( $user );
        }
    }
    add_action( 'user_register', 'tml_user_register' );
        ?>

    Please help me with this, I am trying for past one or two days but in vain. I am not a hardcore PHP programmer but very much a beginner, any help is really appreciated. Thank you in advance.


    0 0

    I have a news website, how can I give this data for app development like json? I'm intersted to know which ways exists to deliver content for external uses?


    0 0

    Hi,

    Im working on specific project for my client.
    They got their own database with products on mySQL server (images/title/meta data). They use it for their company system.

    They want big website with lots of posts and pages but they also want to display their products online. I dont want to import them into WP database 'cos data in DB are always changing.

    So if I create custom post type "products" is there any chance to extend WP_QUERY to query posts from different database and use results as standard WP post object?

    Thank you.


    0 0

    I have new status posts on a Wordpress blog that get published on Saturday nights with the title "UNCHECKED".

    There are a few dozen "client" WP sites that would like to display the current status from the blog infrequently from Saturday night until Friday at noon when the status may change to "DOWN", "UP" or remain "UNCHECKED".

    Is there a way to configure wp_feed_cache_transient_lifetime to force the websites to display the current status using the following intervals?

    Friday 8pm-9am: 3hr intervals for 157 hours
    Friday 9am-noon: 1hr intervals
    Friday noon-3pm: 15 minute intervals
    Friday 3pm-8pm: 5 minute intervals


older | 1 | .... | 334 | 335 | (Page 336) | 337 | 338 | .... | 413 | newer