Are you the publisher? Claim or contact us about this channel

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

older | 1 | .... | 402 | 403 | (Page 404) | 405 | 406 | .... | 413 | newer

    0 0

    Hi there,

    I have a custom field after the checkout billing form that needs to be mandatory and visible only if the user chooses a specific shipping method.

    Here's the code I managed to place until now:

     * Add the field to the checkout
    add_action( 'woocommerce_after_checkout_billing_form' , 'my_custom_checkout_field' );
    function my_custom_checkout_field( $checkout ) {
        echo '<div id="my_custom_checkout_field"><h3>' . __('Ponto da Rede Pickup') . '</h3>';
        woocommerce_form_field( 'my_field_name', array(
            'type'          => 'text',
            'class'         => array('my-field-class form-row-wide'),
            'label'         => __('Escolha um ponto para a recolha da encomenda em <a href="" target="_blank">Rede Pickup</a>'),
            'placeholder'   => __('Coloque referência do ponto de recolha. Ex: X6051'),
            ), $checkout->get_value( 'my_field_name' ));
        echo '</div>';

    How can I turn this field mandatory and active only if the user chooses a particular shipping method?



    0 0

    hello! I'm trying to filter for the content in excerpts of posts wherever the excerpt would normally display, and I've had success so far by using this:

    add_filter( 'get_the_excerpt', 'excerpt_custom_content' );
    function excerpt_custom_content($content){
    	if( is_post_type_archive('teachings') ) {
    		$content .= '<p>custom content</p>';
        	return $content;

    that get the custom content to display in the excerpts on the archive pages for my custom post type, but then i ran into a problem when I created a custom taxonomy (book) for my custom post type (teaching), and added a link to my menu to display the posts which selected 'deuteronomy' in the 'book' taxonomy (so the link looks like this "

    To the best of my understanding this is a category archive page, so I entered the code

    add_filter( 'get_the_excerpt', 'excerpt_custom_content_cat' );
    function excerpt_custom_content_cat($content){
    	if(is_category() ) {
    		$content .= '<p>custom content</p>';
        	return $content;

    in my functions.php but nothing changed on the page.

    I'll also need it to only apply to my custom post type 'teachings', so... I'm very much at a loss on this one, and would appreciate any bit of help.

    thank you very much for reading this posts and thank you in advance for any help you provide!

    0 0

    A little while ago I created a website that I wanted to restrict access to a certain page after payment from PayPal. I am currently going through the process of configuring the website using WordPress and I am struggling with it.

    The code I used for my previous website is below:-

    include ("connect.php");
    if($_SESSION['fromProcess'] == "false"){
       //send them back
       header("Location: play.php");
       //reset the variable
       $_SESSION['fromProcess'] = "false";
    $uid = $_SESSION['uid'];
    $txn = $_SESSION['token'];
    if( (!isset($_SESSION['uid'])) && (!isset($_SESSION['token'])) ){
        header('Location:') ;
    	//stop executing the script

    Is there a way to do something similar with WordPress?


    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 "
    $lastposts = get_posts('numberposts=1');
    foreach($lastposts as $post) :

    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:

    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

    I need to output the primary menu for a plugin I'm working on and I was able to output the menu with:
    echo wp_nav_menu();

    But that outputs whichever menu is alphabetically saved first. The format of the output isn't the issue here like most people using wp_nav_menu() but the ability to make it output which menu is selected by the user as the primary. What argument would I pass through? I've tried things like this, with no luck:

    echo wp_nav_menu(array('menu' => 'primary');

    In the end it is a menu that is in a hidden div that I use the content of for a javascript function.

    0 0

    I have a wordpress shortcode which displays selected posts.

     * Special Deals
     * To override this shortcode in a child theme, copy this file to your child theme's
     * theme_config/extensions/shortcodes/shortcodes/ folder.
    function tfuse_special_deals($atts, $content = null)
        extract( shortcode_atts(array('title' => '','cars' => '','link' => '' ), $atts) );
        $html = '';
        $offers = explode(',',$cars);
        $args = array(
            'posts_per_page'  => -1,
            'orderby'         => 'post_date',
            'order'           => 'DESC',
            'include'         => $offers,
            'post_type'       => TF_SEEK_HELPER::get_post_type(),
            'post_status'     => 'publish',
        $posts_array = get_posts( $args );
        $html .= '<div class="special_offers">
            <div id="special_offers">';
            $price_symbol = TF_SEEK_HELPER::get_option("seek_property_currency_symbol","$");
            $fuel_symbol = TF_SEEK_HELPER::get_option("seek_property_consumption_symbol","MPG");
            foreach($posts_array as $car){
                $car_link = get_permalink($car);
                $image = new TF_GET_IMAGE();
                $img = $image->width(310)->height(134)->src(tfuse_get_car_thumbnail($car->ID))->get_img();
                $price = TF_SEEK_HELPER::get_post_option('property_price', 0, $car->ID);
                $fuel = apply_filters('tfuse_fuel_number_format', TF_SEEK_HELPER::get_post_option('property_consumption', 0, $car->ID));
                $date = '01/'.TF_SEEK_HELPER::get_post_option('property_year', '11/2010', $car->ID);
                $date = date("d/m/Y", strtotime($date));
                $date = strtoupper(date("M Y",strtotime($date)));
                $fuel_out = apply_filters('tfuse_power_fuel_symbol_position', tfuse_symbol_position($fuel, $fuel_symbol, 1, ' ', true), $fuel, $fuel_symbol);
                $price_number_str   = apply_filters( 'tfuse_price_number_format', number_format($price,0,'', '.'), $price );
                $price_symbol_str   = '<span class="symbol_price_left">' . $price_symbol .'</span>';
                $price_symbol_pos   = TF_SEEK_HELPER::get_option('seek_property_currency_symbol_pos', 0);
                $out = tfuse_symbol_position($price_number_str, $price_symbol_str, $price_symbol_pos, '', true);
                $html.='<div class="special_item">
                    <div class="special_image"><a href="'.$car_link.'">'.$img.'</a></div>
                    <div class="special_text">
                        <h3><a href="'.$car_link.'">'.$car->post_title.'</a></h3>
                        <div class="info_row"><span>'.__('FIRST REG:','tfuse').'</span> '.$date.'</div>
                        <div class="info_row"><span>'.__('FUEL CONS:','tfuse').'</span> '. $fuel_out .'</div>
                        <div class="info_row"><span>'.__('MILEAGE','tfuse').'</span> '.number_format(TF_SEEK_HELPER::get_post_option('property_mileage', 1, $car->ID),0,'',',').'</div>
                        <div class="special_price">' . $out . '</div>
            $html .= '</div><a class="prev" id="special_offers_prev" href="#"></a><a class="next" id="special_offers_next" href="#"></a>
            <div class="link_more"><a href="'.$link.'">'.__('View All Special Offers','tfuse').'</a></div>
            jQuery(document).ready(function() {
                function carSpecicalInit() {
                    var car_specical = jQuery("#special_offers");
                                    prev : "#special_offers_prev",
                                    next : "#special_offers_next",
                                    infinite: true,
                                    circular: false,
                                    auto: false,
                                    width: "100%",
                                    direction: "down",
                                    scroll: {
                                        items : 1
                jQuery(window).load(function() {
                var resizeTimer;
                jQuery(window).resize(function() {
                    resizeTimer = setTimeout(carSpecicalInit, 100);
        return $html;
    $atts = array(
        'name' => __('Special Deals','tfuse'),
        'desc' => __('Here comes some lorem ipsum description for the box shortcode.','tfuse'),
        'category' => 7,
        'options' => array(
                'name' => __('Title','tfuse'),
                'desc' => __('Text to display above the box','tfuse'),
                'id' => 'tf_shc_special_deals_title',
                'value' => 'SPECIAL DEALS',
                'type' => 'text'
                'name' => __('Specify car','tfuse'),
                'desc' => __('Specify the cars for special deals','tfuse'),
                'id' => 'tf_shc_special_deals_cars',
                'value' => '',
                'type' => 'multi',
                'subtype' => TF_SEEK_HELPER::get_post_type()
                'name' => __('Link','tfuse'),
                'desc' => __('Link for all offers','tfuse'),
                'id' => 'tf_shc_special_deals_link',
                'value' => '#',
                'type' => 'text'
    tf_add_shortcode('special_deals', 'tfuse_special_deals', $atts);

    And I want not to choose them manually but to get 5 last added. I found universal code for get recent posts but I don't know where to put it.

    // Define our WP Query Parameters
    <?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>
    // Start our WP Query
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
    // Display the Post Title with Hyperlink
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    // Display the Post Excerpt
    <li><?php the_excerpt(__('(more…)')); ?></li>
    // Repeat the process and reset once it hits the limit

    0 0

    i have a page in this page i use wp_query , this query run only with admin , the result of query is different base run query Date
    i want using wp_mail function for submit result query to my email
    how can insert query result in body of email?

    0 0

    My data importer accepts any .csv file. So I cannot predict the number of columns or their titles/headers.

    WP core insert() does not escape single quotes despite everything I read indicating that using $wpdb->insert() prepares the INSERT. The codex states the following but the only way to avoid a MySQL error is to escape individual values...

    (array) Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).

    What would be the recommended approach to using prepare() and possibly PDO within the WordPress environment? Keeping in mind I would need to add a number of placeholders based on the users .csv file.

    I'm considering eval() to build the prepare() line but surely that is not safe?

    mysql_real_escape_string() allows the import, escaping single quote, however it is depreciated.

    Thanks community.

    0 0

    I have created a custom role in WordPres admin with the same capabilities as an admin account. Then I have used remove_cap() to remove capabilities that I dont want the user to see.

    Though the plugin "BackWPUp" is still accessable for the user through the menu.

    I have removed capabilities like edit_plugins etc. as from the Codex, but I cant find any way to remove access to specific plugins.

    0 0

    Hi, I coding my own theme with own widgets. Now, I build Category Widget where I want to add icons for category list. But for every item I need unique icon.

    Some solution for this problem?

    0 0


    First of all, apologies if this has been answered before however I have been searching for 2-3 hours in the WP Support unsuccessfully.

    I have several CPT that represent different types of agenda items (event, trainings, workshops...) and I would like to display all of them as an Archive template from a single menu item that it is neither the front page, neither the blog page.

    As submenus of this one, there would be a link to each CPT subtype sluc (I know how to do this). But at first navigation level of the menu I would like to see a mix of all CPT's together.

    Here is what I want to do

    1) Menu Item 1
    2) Menu Item 2
    3) Menu Agenda -> Resolves to an archive page showing cpt1 & cpt2 & cpt3
    3.1) Events CPT1 ->\cpt1
    3.2) Trainings CPT2 ->\cpt2
    3.3) Workshops CPT3 ->\cpt3
    4) Menu Item 4
    5) Menu Item 5



    PS: BTW, I am using pre_get_posts to sort CPTs by a date that is stored in postmeta

    0 0

    Hi everybody, I hope some one could help me with my problem.
    Right now I'm doing a space member for my site using the hook post-admin to haddle my owm GET and POST requests.

    In the confirmation email sent to the user I have this kind of link to activate the user account:
    Activate account

    In my function.php I have my function and my add_action:
    add_action('admin_post_nopriv_activate_account', 'activation_compte_netsign');

    function activation_compte_netsign(){
    $user_login = $_REQUEST['login'];
    $user_id = get_user_by($user_login);
    $user_updated = update_user_meta( $user_id, 'active_account', 1);

    I found in the doc the 'admin_post_nopriv' action has to by used for the logged in user. I'm trying to use this hook but it seems not to work when I'm not logged in as admin. The server answer me with a not found page.

    Can somebody tell me what is wrong ? What I'm missing please ?

    Thank you very much!

    0 0

    Good Day, Can anyone help? I am trying to achieve a rating system similar to that of Rotten tomatoes movie rating site. Is there a plugin i can use to achieve this? Or is there a tweak i can do? What i want to achieve exactly, is to have a picture displayed automatically according to the rating received for a post. Thanks in advance.

    0 0

    (Posted this in the wrong sub forum first, sorry. Should be deleted there.)

    I'm still getting into the WordPress framework, developing my first "real" Plugin and while thinking about my table structure couldn't help to notice that all WordPress core tables use bigint as datatype for any id column.

    I'm wondering if anyone knows the reasoning behind this. For comments or post it may make sense, but for users? If a platform is expected to exceed 4 Billion users I doubt that WordPress will be the software of choice.

    The only possible argument I can imagine would be performance benefits from using uniformly sized primary keys throughout the database. But that's just a very weak guess, because honestly I have no clue about the inner workings of any particular DBMS.

    Why is it "bothering" me? If the usually sufficient int type would be used the fields would only require 4 Bytes of storage instead of 8. What's 4 Bytes? Imagine a big WordPress instance with 10 Million comments. Just looking at them that's id and post id, parent comment and author id (default to 0), per comment. So 10M*4*4B makes 160MB of wasted space.

    It's still not a big number for current storage solutions but together with the other unnecessarily big fields it accumulates over the entire database. I just find it strange that it's the default setup for a largely distributed CMS. Seems like a needless waste of resources. Because I would hazard the guess that 99% of all WordPress installations will never accumulate even close to 4 Billion rows in any of their core tables.

    I realize this comes off like a rant, but I'm really interested to know if there are any good reasons for this design decision. If anybody has more insight to it, sharing would be much appreciated!

    0 0


    How can I add php count of all results this selection:
    $current_tag = single_tag_title("", false);
    ) );

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

    Many thanks for help

    0 0

    Created textarea field use wp_editor

    			'wpautop' => 0,//применять функцию wpautop
    			'media_buttons' => 1,//включить медиакнопку
    			'textarea_name' => 'description', //нужно указывать!
    			'textarea_rows' => 7,
    			'tabindex'      => null,
    			'editor_css'    => '',
    			'editor_class'  => '',
    			'teeny'         => 0,
    			'dfw'           => 0,
    			'tinymce'       => 1,
    			'quicktags'     => 1,
    			'drag_drop_upload' => false
    		wp_editor($_POST['description'], 'editdescription', $settings );

    and this field not supported embed video link from youtube,
    editor for post supported it.
    Why my redactor not provide it ???

    This is screen where video not embedded, How me on this functionality to my costume editor ???
    how you can see, video not add :(

    0 0

    I'm creating a plugin that will only be used in the wordpress admin, not on the front site of the site.

    I've created a custom post type called "sports_players"
    I've also created several custom taxonomies that are only used with that custom post type, for example: "player_age", "player_sport", "player_sport_level"
    There's also a metabox that holds the "player_id".

    What I want to do is get a list of all of the sports listed in "player_sport" (example: football, baseball, basketball, etc) and put them in a dropdown box. Which I have been able to do in several ways, but this is the code I'm using at the moment for that

    <div class="wrap">
         <h2><?php _e( 'Select A Sport' ); ?></h2>
              <form id="ar-sport-form" action="" method="POST">
         $args = array(
         'show_option_none' => __( 'Select A Sport' ),
         'show_count'       => 0,
         'orderby'          => 'name',
         'echo'             => 0,
         'taxonomy'        => 'sports_roster_category',
    <?php $select  = wp_dropdown_categories( $args ); ?>
    <?php $replace = "<select$1 onchange='return this.form.submit()'>"; ?>
    <?php $select  = preg_replace( '#<select([^>]*)>#', $replace, $select ); ?>
    <?php echo $select; ?>
    <input type="submit" name="ar-roster-submit" value="<?php _e('Get Results', 'athletic-roster'); ?>"/>
    </div><!-- .wrap -->

    When someone selects one of the sports from the drop down, using AJAX I want to display a table that shows all of the posts from the sports_player custom post type, along with all of the custom taxonomies and meta data associated with that post entry.

    What I need help with at the moment is trying to figure out how to get all of the data from the posts associated with the selected custom post taxonomy.

    Also, I need to accomplish this without installing any additional plugins.

    Any help would be greatly appreciated.

    0 0

    I'm trying to add the Google Tag Manager to the header.php of my WordPress site but I can't seem to get it in the right location.

    For some reason my body tag is super long. I place the Google Tag Manager snippet after this line of code but it's incorrect.

    I also tried placing it after directly after<body <?php body_class(); ?> but had no luck.

    Any ideas?

    Below is my body tag:

    <body <?php body_class(); ?>data-footer-reveal="<?php echo $footer_reveal; ?>" data-footer-reveal-shadow="<?php echo $footer_reveal_shadow; ?>" data-cae="<?php echo $column_animation_easing; ?>" data-cad="<?php echo $column_animation_duration; ?>" data-aie="<?php echo $animate_in_effect; ?>" data-ls="<?php echo $lightbox_script;?>" data-apte="<?php echo $page_transition_effect;?>" data-hhun="<?php echo $hideHeaderUntilNeeded; ?>" data-fancy-form-rcs="<?php echo $fancy_rcs; ?>" data-form-style="<?php echo $form_style; ?>" data-is="<?php echo $icon_style; ?>" data-button-style="<?php echo $button_styling; ?>" data-header-inherit-rc="<?php echo (!empty($options['header-inherit-row-color']) && $options['header-inherit-row-color'] == '1' && $perm_trans != 1) ? "true" : "false"; ?>" data-header-search="<?php echo $headerSearch; ?>" data-animated-anchors="<?php echo (!empty($options['one-page-scrolling']) && $options['one-page-scrolling'] == '1') ? 'true' : 'false'; ?>" data-ajax-transitions="<?php echo (!empty($options['ajax-page-loading']) && $options['ajax-page-loading'] == '1') ? 'true' : 'false'; ?>" data-full-width-header="<?php echo $fullWidthHeader; ?>" data-slide-out-widget-area="<?php echo ($sideWidgetArea == '1') ? 'true' : 'false'; ?>" data-loading-animation="<?php echo (!empty($options['loading-image-animation'])) ? $options['loading-image-animation'] : 'none'; ?>" data-bg-header="<?php echo $bg_header; ?>" data-ext-responsive="<?php echo (!empty($options['responsive']) && $options['responsive'] == 1 && !empty($options['ext_responsive']) && $options['ext_responsive'] == '1') ? 'true' : 'false'; ?>" data-header-resize="<?php echo $headerResize; ?>" data-header-color="<?php echo (!empty($options['header-color'])) ? $options['header-color'] : 'light' ; ?>" <?php echo (!empty($options['transparent-header']) && $options['transparent-header'] == '1') ? null : 'data-transparent-header="false"'; ?> data-smooth-scrolling="<?php echo $options['smooth-scrolling']; ?>" data-permanent-transparent="<?php echo $perm_trans; ?>" data-responsive="<?php echo (!empty($options['responsive']) && $options['responsive'] == 1) ? '1' : '0' ?>" >

    0 0

    i permanently deleted the checkout and view cart pages that come by default with storefront theme, i want them back with their default settings, is there a way to do that please ?
    i tried removing the theme folder by using filezila and installing it back, it did not wok because any theme i try to install now will keep the pages i have nw but won`t make me restore the theme default pages, any suggestions to restore the storefront theme default pages please ?

    0 0


    I am struggling to find a solution to my problem of requiring different Shipping Classes for different Shipping Zones for the same product.

    Here’s my situation:
    The Product: Silk Ties.
    The cost of standard "national" delivery is $9.95.
    The cost of the standard "international" delivery is $15.

    I have set up two Shipping Zones: National and International.

    When editing the product, I’m only allowed one option of Shipping Class.

    How can I apply the two different Shipping Classes (standard national and standard international delivery) to the one product?


older | 1 | .... | 402 | 403 | (Page 404) | 405 | 406 | .... | 413 | newer