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 | .... | 399 | 400 | (Page 401) | 402 | 403 | .... | 413 | newer

    0 0

    Hi, I need to match first page than category in wordpress, when the url is the same. I´v tried a lot and still does not work properly.


    0 0

    I want to remove the post dates from all post and home page, I understand that the dates are added by the theme. So one of the way to do these is change the theme files. But that is not feasible and i cannot change the theme. Also this theme (comercial ) will not take this as a request. But Its obvious that the date is assocaited with the post. and there must be a way to manipulate ( make it blank) when the date is requested by a theme.I searched the forum but could not find anything. So I would appreciate any help in this regard.

    This is the site i am referring to.


    0 0

    Date picker works fine

    When page first displays a thin grey bar appears at the bottom left of the screen which inspector identifies as datepicker

    div#ui-datepicker-div. etc.

    When I go into a datepicker field, the grey bar disappears

    Here is where I enable datepicker

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    add_action('wp_head',"enqueue_all");
    add_action('wp_head','add_my_script');
    
    function enqueue_all()
    {
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_style('jquery-style','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
    }
    function add_my_script()
    {    print "<script>
    	jQuery(document).ready(function(){
    
    	   jQuery('#dbsDate').datepicker({minDate: 0,
    					 dateFormat : 'dd-mm-yy',
    					changeMonth : true,
    					changeYear : true,
    	});
     });
    </script>";
    }

    Any ideas much appreciated.


    0 0

    Hello,
    I'm having problem regarding admin pointers. The dismissed pointers are not being saved as dismissed pointers for the user meta due to which it is appearing again. To be clear, the dismissed pointers are supposed to be stored in the database but in my case it is not getting saved.
    The code are written below:

    function wptuts_pointer_load( $hook_suffix ) {
    
        // Don't run on WP < 3.3
        if ( get_bloginfo( 'version' ) < '3.3' )
            return;
    
        $screen = get_current_screen();
        $screen_id = $screen->id;
    
        // Get pointers for this screen
        $pointers = apply_filters( 'wptuts_admin_pointers-wen_skill', array() );
    
        if ( ! $pointers || ! is_array( $pointers ) )
            return;
    
        // Get dismissed pointers
        $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
        print_r($dismissed);
        $valid_pointers =array();
    
        // Check pointers and remove dismissed ones.
        foreach ( $pointers as $pointer_id => $pointer ) {
    
            // Sanity check
            if ( in_array( $pointer_id, $dismissed ) || empty( $pointer )  || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) )
                continue;
    
            $pointer['pointer_id'] = $pointer_id;
    
            // Add the pointer to $valid_pointers array
            $valid_pointers['pointers'][] =  $pointer;
            //var_dump($valid_pointers);
    
        }
     print_r($valid_pointers);
        // No valid pointers? Stop here.
        if ( empty( $valid_pointers ) )
            return;
    
        // Add pointers style to queue.
        wp_enqueue_style( 'wp-pointer' );
    
        // Add pointers script to queue. Add custom script.
        wp_enqueue_script( 'wptuts-pointer', plugins_url( 'js/wptuts-pointer.js', __FILE__ ), array( 'wp-pointer' ) );
    
        // Add pointer options to script.
        wp_localize_script( 'wptuts-pointer', 'wptutsPointer', $valid_pointers );
    }
        function wptuts_register_pointer_testing( $p ) {
            $p['abf'] = array(
                'target' => '#wen_skill_charts_settings_metabox',
                'options' => array(
                    'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
                        __( 'Title' ,'plugindomain'),
                        __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.','plugindomain')
                    ),
                    'position' => array( 'edge' => 'left', 'align' => 'middle' )
                )
            );
            $p['cgi'] = array(
                'target' => '#wen_skill_charts_content_skills',
                'options' => array(
                    'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
                        __( 'Title' ,'plugindomain'),
                        __( 'New Lorem ipsum dolor sit amet, consectetur adipiscing elit.','plugindomain')
                    ),
                    'position' => array( 'edge' => 'bottom', 'align' => 'middle' )
                )
            );
            return $p;
        }

    And the js:

    jQuery(document).ready( function($) {
        wptuts_open_pointer(0);
        function wptuts_open_pointer(i) {
            //pointer = wptutsPointer.pointers[i];
        $.each(wptutsPointer.pointers, function (index, value) {
            options = $.extend( wptutsPointer.pointers.options, {
                close: function() {
                    $.post( ajaxurl, {
                        pointer: value.pointer_id,
                        action: 'dismiss-wp-pointer'
                    });
                }
            });
            $(value.target).pointer(value.options ).pointer('open');
        });
        }
    });

    Any help would be highly appreciated.
    Thanks!


    0 0

    I'd like to put a function or action in our functions.php that automatically publishes ONE specific post at a specific times during the week, then returns it to draft status after a few hours. This would be reoccuring for that specific post. EX:

    Monday-Friday
    3pm: published --- 10pm: draft

    Saturday/Sunday
    3pm: published --- 830pm: draft

    I've been looking at WP-Cron, and Post Status Transition, but haven't quite figured out making them work together. If anyone can point me in the right direction, I'd duly appreciate it. THANKS!


    0 0

    Hello,

    How can I add php count of all results this selection:
    <?php
    $current_tag = single_tag_title("", false);
    query_posts(array(
    'cat'=>'29,27,11,32,35,9,58,54,39',
    'showposts'=>'2',
    'tag_slug__and'=>array($current_tag),
    ) );
    ?>

    I want to show some link if there are more than 2 posts.

    Many thanks for help


    0 0

    Hello,

    i display a numeric pagination with the following code. It works perfect, just one little thing i wanna change: When i have as example 100 Pages i want to show 1, 2, 3, ... 98, 99, 100. now it shows really every page and this is not so good.

    function pagination($pages = '', $range = 4)
    {
         $showitems = ($range * 2)+1;
    
         global $paged;
         if(empty($paged)) $paged = 1;
    
         if($pages == '')
         {
             global $wp_query;
             $pages = $wp_query->max_num_pages;
             if(!$pages)
             {
                 $pages = 1;
             }
         }
    
         if(1 != $pages)
         {
             echo "<div class=\"pagination\"><span>Seite ".$paged." von ".$pages."</span>";
             if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
             if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";
    
             for ($i=1; $i <= $pages; $i++)
             {
                 if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
                 {
                     echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
                 }
             }
    
             if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";
             if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
             echo "</div>\n";
         }
    }

    0 0

    Hello everyone,
    I'm currently grouping posts on the main page via category. Problem is that when I select multiple categories (ie: A and B) for a post, it then shows up on the main page in both the A and B category.
    I was wondering if there is a way of defining a 'main' category and then on the main page only show posts with that as a main category.
    I know YOAST plugin allows you to select a primary category but I have found no way of applying it to my problem.
    Thanks in advance!


    0 0

    My site was working correctly yesterday and then today I'm getting a white home page, and the error in the title is showing up in the error log along with
    "PHP Notice: Trying to get property of non-object"
    on the same line in functions.php. Can someone help me out? I'm incredibly lost


    0 0

    Hi,

    (original post)

    I'm trying to add a base64 image to a WordPress page with wp_update_post().

    The string I'm trying to insert looks like:

    <img src="data:image/jpeg;base64,...." alt="foo" class="bar">

    Now wp_update_post seems to truncate the colon and anything before it until the double quote (ie: 'date:'), resulting in:

    <img src="image/jpeg;base64,...." alt="foo" class="bar">

    Thus breaking my image. However, this does work if I manually update the page.

    I've found some people having similar problems with styles caused by KSES, but I can't seem to figure out a solution for this specific issue.

    Does anyone have a suggestion?


    0 0

    I've animated the Audio Shortcode using max-width but the issue is that the progress rail does not animation with it. Whenever I try to update the width via JQuery it is being overwritten after the fact. Here's what I am doing to animate my audio shortcode:

    1) Add container:

    function audio_shortcode_container( $html ) {
       return "<div class=\"audioContainer\">{$html}</div>";
    
    }
    add_filter( 'wp_audio_shortcode', 'audio_shortcode_container' );

    The CSS which handles the animation:

    div.audioContainer {
    	max-width: 80px;
    	overflow: hidden;
    	-webkit-transition: max-width 0.5s;
    			transition: max-width 0.5s;
    }
    
    div.audioContainer.active {
    	max-width: 100%;
    }

    Finally, the JQuery that triggers the animation:

    jQuery( document ).ready( function( $ ) {
    	$( 'div.audioContainer' ).click( function() {
    		var containerWidth = $( '#content' ).width();
    		$( this ).addClass( 'active' );
    		$( this ).find( 'audio' )[0].play();
    		$( this ).find( '.mejs-time-rail' ).css( 'width', ( containerWidth - 174 ) + 'px' );		// Gets overwritten
    		$( this ).find( '.mejs-time-total' ).css( 'width', ( containerWidth - 184 ) + 'px' );		// Gets overwritten
    	} );
    } );

    So, whenever the active class is added it trigger the CSS animation and starts to play the audio file. The problem is ( I believe ) whenever the audio-file is triggered to play the progress bar is updated with a style width attribute and supersedes my JQuery style update above.

    How can I update the progress bar to also show whenever I trigger this animation?


    0 0

    Hi, I'm using the filter given on stackoverflow the get at the message shown when something is added to the cart. It works well.

    However, I want to add the variation to the product's name. Instead of "Red T-shirt has been added to your basket." I need "Red T-shirt large has been added to your basket."

    Can any of you clever people help? Here's the filter:

    add_filter ( 'wc_add_to_cart_message', 'wc_add_to_cart_message_filter', 10, 2 );
    function wc_add_to_cart_message_filter($message, $product_id = null) {
        $titles[] = get_the_title( $product_id );
    
        $titles = array_filter( $titles );
        $added_text = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', sizeof( $titles ), 'woocommerce' ), wc_format_list_of_items( $titles ) );
    
        $message = sprintf( '%s <a href="%s" class="button">%s</a>&nbsp;<a href="%s" class="button">%s</a>',
                        esc_html( $added_text ),
                        esc_url( wc_get_page_permalink( 'checkout' ) ),
                        esc_html__( 'Checkout', 'woocommerce' ),
                        esc_url( wc_get_page_permalink( 'cart' ) ),
                        esc_html__( 'View Cart', 'woocommerce' ));
    
        return $message;
    }

    Be happy for ever,
    Steve


    0 0

    I have 2 forms on one page. When I submit a value into the first form it is stored until I submit the value into the second form. After storing the variables into $_SESSIONS, this still occurs. Here is my code:

    $Question11 = isset($_POST['Question1']) ? $_POST['Question1'] : '';
    $Question22 = isset($_POST['Question2']) ? $_POST['Question2'] : '';
    $Question33 = isset($_POST['Question3']) ? $_POST['Question3'] : '';
    $Question44 = isset($_POST['Question4']) ? $_POST['Question4'] : '';
    
    $_SESSION['Question1']   = $Question11;
    $_SESSION['Question2']   = $Question22;
    $_SESSION['Question3']   = $Question33;
    $_SESSION['Question4']   = $Question44;

    Any suggestions? I have the <?php
    if ( !session_id() )
    session_start();
    ?>

    at the very top of my page.


    0 0

    Hey,
    I'm using this hack for custom page titles:

    https://digwp.com/2010/04/custom-page-titles/

    // Custom Page Titles
    add_action('admin_menu', 'custom_title');
    add_action('save_post', 'save_custom_title');
    add_action('wp_head','insert_custom_title');
    function custom_title() {
    	add_meta_box('custom_title', 'Change page title', 'custom_title_input_function', 'post', 'normal', 'high');
    	add_meta_box('custom_title', 'Change page title', 'custom_title_input_function', 'page', 'normal', 'high');
    }
    function custom_title_input_function() {
    	global $post;
    	echo '<input type="hidden" name="custom_title_input_hidden" id="custom_title_input_hidden" value="'.wp_create_nonce('custom-title-nonce').'" />';
    	echo '<input type="text" name="custom_title_input" id="custom_title_input" style="width:100%;" value="'.get_post_meta($post->ID,'_custom_title',true).'" />';
    }
    function save_custom_title($post_id) {
    	if (!wp_verify_nonce($_POST['custom_title_input_hidden'], 'custom-title-nonce')) return $post_id;
    	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
    	$customTitle = $_POST['custom_title_input'];
    	update_post_meta($post_id, '_custom_title', $customTitle);
    }
    function insert_custom_title() {
    	if (have_posts()) : the_post();
    	  $customTitle = get_post_meta(get_the_ID(), '_custom_title', true);
    	  if ($customTitle) {
    		echo "<title>$customTitle</title>";
          } else {
        	echo "<title>";
    	      if (is_tag()) {
    	         single_tag_title("Tag Archive for ""); echo '" - '; }
    	      elseif (is_archive()) {
    	         wp_title(''); echo ' Archive - '; }
    	      elseif ((is_single()) || (is_page()) && (!(is_front_page())) ) {
    	         wp_title(''); echo ' - '; }
    	      if (is_home()) {
    	         bloginfo('name'); echo ' - '; bloginfo('description'); }
    	      else {
    	          bloginfo('name'); }
    	      if ($paged>1) {
    	         echo ' - page '. $paged; }
            echo "</title>";
        }
        else :
          echo "<title>Page Not Found | Envision</title>";
    	endif;
    	rewind_posts();
    }

    I have a custom mysql table with movie id and title and a "view-movie" page and I want to display the movie-title inside the <title>.
    The esc_url_raw($_SERVER['REQUEST_URI']) will return like: /view-movie/?id=70
    I modified the code like this:

    echo "<title>";
            $v_m_a = explode('/', esc_url_raw($_SERVER['REQUEST_URI']));
             if (in_array("view-movie", $v_m_a)) {
                $id = $_GET["id"];
                global $wpdb;
                $results = $wpdb->get_results("SELECT * FROM wp_mycustomtable WHERE id = $id");
                foreach($results as $r) { echo $r->Titel; echo ' - '; }
              } elseif (is_tag()) {
                 single_tag_title("Tag Archive for ""); echo '" - '; }
              elseif (is_archive()) {
                 wp_title(''); echo ' Profil - '; }
              elseif ((is_single()) || (is_page()) && (!(is_front_page())) ) {
                 wp_title(''); echo ' - '; }
              if (is_home()) {
                 bloginfo('name'); echo ' - '; bloginfo('description'); }
              else {
                  bloginfo('name'); }
              if ($paged>1) {
                 echo ' - page '. $paged; }
            echo "</title>";

    It is working fine. But is it save to use esc_url_raw($_SERVER['REQUEST_URI']) or is there maybe a better way?


    0 0

    I want to do a query to find something like 75% in a text field.
    I googled and found 2 implementations, both do not seem to work:

    SELECT ... WHERE myCol LIKE '%75[%]%'

    and

    SELECT ... WHERE myCol LIKE '%75!%%' ESCAPE '!'

    Can i do such a thing in wp?


    0 0

    Where should I check for the code coverage stats when using PHPUnit for WordPress?

    My WordPress setup:

    I have setup WordPress using VVV and my testing suite includes PHPUnit and WP-CLI.

    How I executed test cases to find code coverage?

    When I execute phpunit command to test a WordPress plugin, I'm able to see, if the test cases passed or failed. In my case there were *no failures*.

    To find the code coverage, I executed phpunit --coverage-text=./coverage.txt, the test cases passed but I'm unable to find the coverage.txt file to check the actual code coverage stats.

    A search for coverage.txt file in plugin's folder using the Windows explorer returned no results. Am I missing something?


    0 0

    hello, i'm trying to delete a metadata of custom post

    i've tried an action in my functions.php

    add_action( 'delete_metadata', 'del_met', 10, 4 );
    function del_met( $meta_type, $meta_key, $delete_all = true)
    {
        if ( $meta_type == 'shop_order' ) {
            delete_metadata( $meta_type, $object_id, $meta_key, $meta_value, $delete_all = true);
        }
    }

    but the metadata is there and isn't deleted, need help, what am i doing wrong?


    0 0

    I am working on something for my plugin to hide the added page templates from the menu, everything works fine on my web matrix test sites, however when I try it on my live site it does not work at all. I don't even get a wp_die from within the function so the filter is not being applied at all. Here is the code.

    // filter to modify front end menu and remove our custom template pages
    //wp_die( 'HELLO' );
    add_filter( 'wp_nav_menu_objects', 'ura_menu_exclude_pages', 10, 2 );
    
    /**
     * function ura_menu_exclude_pages
     * Removes custom page templates from front end menus so user doesn't have to
     * @since 1.5.3.0
     * @updated 1.5.3.0
     * @access public
     * @params array $items The menu items, sorted by each menu item's menu order.
     * @params object $args An object containing wp_nav_menu() arguments.
     * @returns array $items The menu items, with ura custom templates removed
    */
    
    function ura_menu_exclude_pages( $items, $args ){
    	//wp_die( 'THIRD' );
    	$tc = new URA_TEMPLATE_CONTROLLER();
    	$ids = $tc->get_custom_templates_menu_ids();
    	foreach( $items as $i => $object ){
    		if( in_array( $object->ID, $ids ) ){
    			unset( $items[$i] );
    		}
    	}
    	return $items;
    }

    This is in a separate file - no class inside the main folder.

    Does anyone have any ideas as to why this is happening? I am at a loss here.

    I am using the Basic Theme obtained from WordPress themes, and using the same on all sites, test and live so the themes are the same.


    0 0

    Hello everyone,

    I'am looking for a trick to remove the "Personal Options" and "About Yourself" section on the profile page.

    With some CSS tweak (like tr.user-url-wrap,tr.user-aim-wrap) I have hide the subcontent. Now I wish to remove the "main" categorie. Because those two are now empty. Thank you.

    Alex.


    0 0

    Hi there. My site is http://www.acenavigates.com and I am using the PenciDesign "Soledad" theme. Which, to be honest, is absolutely brilliant. I've pretty much got everything set up, but I've run into quite the annoying problem.

    In the Soledad theme, when you click on the Pinterest icon at the bottom of the post, it takes you to the Pinterest pin page. But the problem is, it uses my featured image as the ONLY option for pinning. This is NOT ideal because my featured images need to be quite horizontally skinny to fit the aesthetic of my featured slider on my homepage. Pinterest is much better using vertical images. And anyways, I'm sure the user would appreciate the variety of selection.

    I've gotten as far as locating the function in Soledad's .php file. This is what it says.

    $pinterest_image = wp_get_attachment_url(get_post_thumbnail_id( $post->ID ));

    Now I understand that get_post_thumbnail_id( $post->ID )) is the FEATURED IMAGE being retrieved as the image to be used, if I'm not mistaken.

    But what can I replace this with so that the user is given options as to which image to use as the pin?

    I've searched all over the web the past day and a half, and spent hours in the wordpress codex documentation to no avail. There are similar inquiries here on the forum, but none of them solve my issue.

    I would definitely appreciate your help.


older | 1 | .... | 399 | 400 | (Page 401) | 402 | 403 | .... | 413 | newer