Display Custom Post Type on Toolset Types Plugin

I have created a custom post type with php and my problem is that this post type is not appearing in the menu of Toolset Types Plugin. I think that must be some option that I have to fill but I have tried with almost everything and I don´t know why this is happening.

I want to edit the relationship between post types, specially between cars and news.

My code to create the custom post type is this.

function car_post_type() {
    $labels = array(
        'name' => 'Coches',
        'singular_name' => 'Coche',
        'menu_name' => 'Coches',
        'name_admin_bar' => 'Coches',
        'parent_item_colon' => 'Padre:',
        'all_items' => 'Todos los coches',
        'add_new_item' => 'Añadir nuevo coche',
        'add_new' => 'Añadir coche',
        'new_item' => 'Nuevo coche',
        'edit_item' => 'Editar coche',
        'update_item' => 'Actualizar coche',
        'view_item' => 'Ver coche',
        'search_items' => 'Buscar coches',
        'not_found' => 'No hay resultados',
        'not_found_in_trash' => 'No se han encontrado coches en la papelera',
    $rewrite = array(
        'slug' => 'coche',
        'with_front' => true,
        'pages' => true,
        'feeds' => true,
    $args = array(
        'label' => __( 'Car', 'clever' ),
        'description' => __( 'Cars', 'clever' ),
        'labels' => $labels,
        'supports' => array(
            'title', 'editor', 'excerpt', 'thumbnail', 'revisions',
        'taxonomies' => array(),
        'hierarchical' => false,
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 5,
        'menu_icon' => 'dashicons-dashboard',
        'show_in_admin_bar' => true,
        'show_in_nav_menus' => true,
        'can_export' => true,
        'has_archive' => true,
        'exclude_from_search' => false,
        'publicly_queryable' => true,
        'rewrite' => $rewrite,
        'capability_type' => 'post',

    register_post_type('car', $args);
add_action('init', 'car_post_type', 0);

Thanks for your help.

Source: stackoverflow-php

I REALLY need to know how to target keyboard events in the contact form 7 input fields

I am just trying to be able to target keyboard events on contact form 7 but since input fields in contact form 7 are created differently from how they are created in HTML, I have no clue how to target any events or if it is even possible. There also does not seem to be any documentation on this that I can find.

Here is an exmple of what I wish would work:

[text* first-name class:first-name onkeyup=”MyFunction()”]

obviously, this does not work. So what will? Is there a way? Thank you in advance.

Source: stackoverflow-javascript

want to add script tag codings in wocommerce add_action

add_action( 'woocommerce_single_product_summary', 'whatsappdirect1', 35 );

function whatsappdirect1() {
    echo '[anchor-tag a class="btn btn-social-icon btn-whatsapp" href="javascript:window.location=waCurrentPage();">[img tag border="0" alt="W3Schools" src="http://sareechoice.com/wp-content/uploads/2017/07/whatsappicon.png" width="290" height="200"][anchor-tag-closed]';

waCurrentPage = function() {
  return encodeURI("whatsapp://send?phone=+9199999999&text=please let me know the price of the product in the link : " + 'http://' + window.location.hostname + window.location.pathname);


i have made the following codes that allows mobile users to contact my support team on my website on my whatsapp along with the link of the page ..so now in the above add_action code i have put the codes that will display my button which has to be clicked on the woocommerce product page …but now the problem is that the script codes which does actual work of opening my whatsapp number with predefault link that allow users to send it to my number …so how to insert that script code and also where to insert that ..is there anyway where i can keep both codes at one add_action function of wooocommerce …

thanks in advance

Source: stackoverflow-javascript

How to add a custom button on an item that does not have Stock?

I’m working with WordPress and WooCommerce, I need to add a contact button if in my store some product runs out of stock, ie:

If Stock is 0, show me a contact button.

The following image looks more specific where I want to insert it:

Show image

I have found how to add the button, but it is added to all the products, and I just want the button to appear when I have no stock on any of my products.
Here is the code used:

add_action('woocommerce_after_add_to_cart_button', 'boton_subasta');
function boton_subasta(){
     global $product;
    if ( ! $product->is_in_stock(){

        echo '<button type="submit" class="button alt" onclick="window.location.href=http://">contacto</button>';    

Source: stackoverflow-php

Woocommerce: I want to make the shopping cart drop down after add to cart

I have been trying to do something rather simple: getting a cart to dropdown after a user added something to their cart and stay there, until they click it away.

I’ve tried adding a php function through functions.php in my childtheme, adding custom javascript code, but it doesn’t react. I can’t seem to capture the event with javascript/jquery.
Woocommerce reloads the page after adding something to the cart, since it’s a variation product.

This is what the html code for the cart looks like:

  • </li> <li> </li>
    TOTAL: 199,75
    </div> </ul> </div>

    And this is what I have been trying to do with jquery:

    window.jQuery( document ).ready( function ( $ ) {
        $( 'body' ).on( 'added_to_cart', function ( event, fragments, cart_hash, $button ) {
            $('body').on('click', function(){
        } );
    } );

    Source: stackoverflow-javascript

Single post Sidebar (based on category)

I’m not good with PHP.

I use BeTheme and it’s possible to display a sidebar for each category page.

Now i need to display a sidebar for single post based on category.

For exemple :

  1. On the Category page called “WP1” I find the Sidebar “Sidebar WP1”

  2. When i vist any single post on the Category “WP1” I need to display “Sidebar WP1”

This is the sidebar-blog.php file :


I need to edit the follinwg file to get the nedded result :


Any help please ? thanks

Source: stackoverflow-php

Trigger .slideUp at anchor

I’m trying to trigger an element to slide up when I reach an anchor. The anchor ID is #blacksection and the element class is .vc_tta-panels-container. I read on another thread that you can trigger onclick actions using something like:


And then I’m using;

  jQuery("#blacksection").on('click', function() {

as the remaining JS. So I have this:

  jQuery("#blacksection").on('click', function() {

Which isn’t working, only just started learning JS and it’s baffling my mind, can anyone shed some light on triggering .slideUp for a class at an anchor?

Source: stackoverflow-javascript

How do prevent my site from creating multiple copies of my index page?

My WordPress site is creating dozens of copies of my index page in a folder it calls /page/, so I’ve got example.com/page/1/, example.com/page/2/, …example.com/page/49/ all the same as my index page.

I tried the following, but it only redirects the root and not all the pages within the folder.

RewriteEngine on
RewriteRule ^page/(.*)   / [R=301,L]

How do I stop this from happening or redirect the entire contents of the folder? I am not a php programmer.

Source: stackoverflow-php

How to display woocommerce sale price or regular price if there is no sale price

I’m using a woocommerce product addons plugin where I would like to display the price of a product in my dropdown section of the addons.
Currently the code I have is this

$loop = 0;
$current_value = isset( $_POST['addon-' . sanitize_title( $addon['field-name'] ) ] ) ? wc_clean( $_POST[ 'addon-' . sanitize_title( $addon['field-name'] ) ] ) : '';
global $product;
<p class="form-row form-row-wide addon-wrap-<?php echo sanitize_title( $addon['field-name'] ); ?>">
    <select class="addon addon-select" name="addon-<?php echo sanitize_title( $addon['field-name'] ); ?>">

        <?php if ( ! isset( $addon['required'] ) ) : ?>
            <option value=""><?php _e('None', 'woocommerce-product-addons'); ?></option>
        <?php else : ?>
            <!--<option value=""><?php _e('Select an option...', 'woocommerce-product-addons'); ?></option>-->
        <?php endif; ?>

        <?php foreach ( $addon['options'] as $i => $option ) :
            $loop ++;
            $price = apply_filters( 'woocommerce_product_addons_option_price',
                $option['price'] > 0 ? ' + ' . wc_price( get_product_addon_price_for_display( $option['price'] ) ) . '' : '',
            <option data-raw-price="<?php echo esc_attr( $option['price'] ); ?>" data-price="<?php echo get_product_addon_price_for_display( $option['price'] ); ?>" value="<?php echo sanitize_title( $option['label'] ) . '-' . $loop; ?>" <?php selected( $current_value, sanitize_title( $option['label'] ) . '-' . $loop ); ?>><?php echo wptexturize( $option['label'] . ' (' ); echo balanceTags($product->get_price_html()) . $price ?>)</option>
        <?php endforeach; ?>


I’m using this echo


what this does though is display the $”sale price” $”price” but I just want to display just the sale price or just the product price if there is no sale price. Looking at the code below, how would I accomplish this?


Source: stackoverflow-php