Skip to main content

Lista de snippets criados para este tema wordpress.

  1. wc-different-address-off.php
    /** * Esse código adiciona um filtro para desmarcar * o campo "ship_to_different_address" por padrão. * Com isso, os clientes não precisarão desmarcá-lo * manualmente, pois o campo já virá desmarcado automaticamente. */
  2. wc-image-size-single-product-gallery.php
    /** * Altera o tamanho das imagens da galeria de produtos do * plugin Variation Images Gallery for WooCommerce que por padrão * usa o tamanho de nome: 'woocommerce_single' que é 416x416 */
  3. wc-variations-filter-by-category.php
    // Nenhum item foi selecionado em "exibir_como_filtro_em"
  4. wc-woocommerce_admin_meta_boxes_variations_per_page.php
    /** * The function custom_woocommerce_variations_per_page returns the desired number of variations per * page in WooCommerce. * * @param per_page The "per_page" parameter is the number of variations to display per page in a * WooCommerce product variation list. In the given code snippet, the function * "custom_woocommerce_variations_per_page" is defined to override the default value of "per_page" and * set it to 100. This means * * @return the number 100. */
  5. wc-easypay-logos.php
    /** * Adicionar ícones de pagamento personalizados * * @param $icon URL do ícone padrão da Easypay * @param $id ID do meio de pagamento, exemplo: easypay_cc_2, easypay_mb_2, easypay_mbway_2, etc * * @return $icon URL do ícone padrão personalizado via CONFIG SITE ACF */
  6. wc-get-primary-term-produtcat-name.php
    /** * Retorna o nome da categoria pai de um produto * * @param int $prod_id ID do produto * * @return string $cat_name Nome da categoria pai0 */
  7. wc-single-product-acf-tabs.php
    /** * Adicionar TABS especiais se houver conteúdo no ACF * Baseado em: https://woocommerce.com/document/editing-product-data-tabs/ */
  8. wc-single-product-remove-tabs.php
    /** * Remove product data tabs * Baseado em: https://woocommerce.com/document/editing-product-data-tabs/ */
  9. wc-no-stock.php
    /* function cwpai_custom_stock_html($html, $product) { global $product; if (!$product->is_in_stock()) { $post = new_get_page_by_title('Where to Buy'); $url = $post ? get_permalink($post->ID) : '#'; $btn_text = __('Where to Buy', 'polisport'); $html = '

    ' . $btn_text . '

    '; } return $html; } add_filter('woocommerce_stock_html', 'cwpai_custom_stock_html', 10, 2); */
  10. wc-precalc.php
    // Pré-preencher o calculador de custos de envio no carrinho
  11. wc-products-per-page.php
    /** * Função: alterar_numero_produtos_por_pagina * * Callback da função que altera o número de produtos exibidos por página na loja. * * @param int $cols O número atual de produtos por página. * @return int O novo número de produtos por página definido pela função get_field(). */
  12. wc-remove-default-related-products.php
    /** * Remove related and upsell products output - DEAFULT * Baseado em: https://woocommerce.com/document/remove-related-posts-output/ */
  13. white-label.php
    /** * Para ativar WHITE LABEL: if(false) */
  14. wp-disable-update-plugin.php
    /** * Desativa atualizações de plugins específicos * Útil em caso de algum plugin estar causando erros * e que seja necessário prevenir e manter uma versão estável */
  15. wc-loadmore-archive.php
    /** * Read More Products - Archive */
  16. wc-single-product-rename-tabs.php
    /** * Rename product data tabs * Baseado em: https://woocommerce.com/document/editing-product-data-tabs/ */
  17. wc-variation-default-price.php
    /** * Para PRODUTOS VARIÁVEIS * Cria opção de aplicar o preço de uma variação para todas variações * A opção está logo acima do input do valor * * Baseado em: https://gowp.com/apply-the-price-of-a-woocommerce-product-variation-to-all-variations-of-the-same-product/ */
  18. wp-get-menu-array.php
    /** * Função construção menu * @param string $current_menu Nome do menu * * @return array Array de menus */
  19. wp-new_get_page_by_title.php
    /** * The function `new_get_page_by_title` retrieves a page by its title in WordPress and returns it in * the specified output format. * * @param page_title The title of the page you want to retrieve. * @param output The parameter determines the type of data that will be returned. It can be set * to one of the following values: * @param post_type The post type of the page you want to retrieve. By default, it is set to 'page'. * * @return a post object of the page with the specified title. If no page is found with the given * title, it will return null. */
  20. wc-cart-norefresh.php
    /** * The custom_add_to_cart_script function adds a script to the footer of a WordPress page that handles * the add to cart functionality for a WooCommerce single product. */
  21. wc-filter-ajax.php
    /** * Filter Ajax * Baseado em: https://code.mukto.info/woocommerce-ajax-product-search-and-category-filter-without-plugin/ */
  22. wc-js-css.php
    /** * Para usar apenas de DEV para testar CSS ou JS */
  23. wc-zicode-countrycode.php
    /** * Validação personalizada de código postal. * * Verifica se um código postal é válido para o país atual. * Aceita códigos postais que começam com duas letras * seguidas por sete caracteres numéricos. * Exemplo: ES08008 ou FR08008 * * @param boolean $valid Se o código postal é válido. * @param string $postcode O código postal a ser validado. * @param string $country O código do país do endereço do cliente. * * @return boolean $valid O novo valor da validação do código postal. */
  24. wc-order-product-by-name.php
    /** * The function "order_product_by_name" is used to order the query results by the product name in * ascending order for the "product" post type and its taxonomies. * * @param query The query object that is being modified. * * @return nothing (null). */
  25. wc-minicart-buttons.php
    /** * Mini Cart - Checkout & View Cart buttons */
  26. acf-callback-product-attributes.php
    /** * The function `get_wc_product_attributes_callback` retrieves WooCommerce product attributes and adds * them as choices to a field in the Advanced Custom Fields plugin. * * @param field The "field" parameter is the field object that is being loaded by the ACF (Advanced * Custom Fields) plugin. It contains information about the field, such as its name, label, type, and * value. * * @return the modified array with the added choices for the product attributes. */
  27. acf-global-options.php
    /** * Advanced Custom Fields Options function * Always fetch an Options field value from the default language */
  28. breadcrumb.php
    /** * Change the breadcrumb separator * Fonte: https://woocommerce.com/document/customise-the-woocommerce-breadcrumb/ */
  29. cf7-change-input-for-button.php
    /** * Altera a TAG INPUT TYPE SUBMIT por BUTTON TYPE SUBMIT * Baseado em: https://wpklik.com/wordpress-tutorials/html5-submit-button-element-wordpress/ */
  30. cf7-disable-autop.php
    /** * Remove auto p from Contact Form 7 shortcode output * Baseado em: https://wordpress.stackexchange.com/questions/222580/contactform7-remove-tags-with-wpcf7-autop-false-from-functions-php */
  31. css-admin-loba.php
    /** * Admin Theme Loba */
  32. enqueue-css.php
    /** * Enfileira os estilos CSS personalizados para o painel de administração */
  33. enqueue-js.php
    // Youtube Iframe API
  34. functions.php
    /** * Retorna o ip do usuário * * @return string Ip */
  35. get_sharelinks.php
    /** * Retorna o link de compartilhamento da Rede Social * https://crunchify.com/list-of-all-social-sharing-urls-for-handy-reference-social-media-sharing-buttons-without-javascript/ * * @param string $rede Nome da Rede Social * @param string $url Endereço URL da Rede Social (SITE CONFIG / Exemplo: faceboo.com) * * @return string URL de compartilhamento */
  36. google-analytics.php
  37. hide-admin-bar.php
    /* Disable WordPress Admin Bar for all users */
  38. lists-snippets.php
    /** * Shortcode auxiliar para verificar se os seus snippets estão no servidor * Adicione este shortcode a uma página e verifique a listagem de snippets */
  39. performance.php
    // REMOVE WP EMOJI
  40. read-more.php
    /** * Read More Ajax * Baseado em: https://weichie.com/blog/load-more-posts-ajax-wordpress/ */
  41. readme-to-git.php
    //var_dump($args);
  42. remove-css-gutemberg.php
    /** * Remove Gutenberg Block Library CSS from loading on the frontend * Don't load Gutenberg-related stylesheets. */
  43. remove-otgs-message.php
    /** * Remove alerta do WPML */
  44. setting-pages.php
    /** * Oculta o suporte a: editor, thumbnail, page-attributes, post-formats * no wp-admin para as páginas no array: $setting_pages_titles * Funcionalidade útil para trabalhar apenas com ACF´s na página */
  45. site-config.php
    /** * Configurações do Site sem usar CPT */
  46. snippets.php
    /** * Crie seus códigos na pasta de snippets. * Evite alterar o arquivo functions.php o máximo possível. * Use o comando require_once para incluir o arquivo snippets.php no seu tema. * Ele pode ser adicionado usando o caminho do arquivo do tema, usando get_theme_file_path(). * * Suponha que você tenha a seguinte estrutura de diretórios em seu tema WordPress: * /theme-name * ├── functions.php * └── snippets * └── snippets.php * * * Add all files inside snippets folder with require * in functions theme except snippets.php * INSTALL: * Copy and paste inside functions.php this: * * Create your codes in the snippets folder. * Avoid changing the functions.php file as much as possible. * * $snippetsPath = get_theme_file_path("/snippets/snippets.php"); * if (file_exists($snippetsPath) && is_dir(dirname($snippetsPath))) { * require_once $snippetsPath; * } else { * wp_die("A pasta 'snippets' ou o arquivo 'snippets.php' não foram encontrados."); * } * */
  47. videos.php
    /** * Retorna o endereço do thumbnail do respectivo player (Youtube ou Vimeo) * * @param string $url Endereço cadastrado no artigo * * @return string Endereço do thumbnail do respectivo player (Youtube ou Vimeo) */
  48. wc-add-after-tabs-paginated-slider.php
    /** * Baseado em: https://stackoverflow.com/questions/57974137/how-to-add-custom-content-after-the-tab-section-and-before-you-may-also-like */
  49. wc-add-after-tabs-product-cta.php
  50. wc-add-after-tabs-related-products.php
    /** * Adiciona um RELATED PRODUCT PERSONALIZADO * Baseado em: * * https://gist.github.com/mujuonly/28b0056c10d04f23cf890f547b9d4c84 * * https://hooks.wbcomdesigns.com/reference/functions/wc_get_related_products/ */
  51. wc-add-after-tabs-simple-fullscreen-slider.php
    /** * Slider abaixo das tabs * Baseado em: https://stackoverflow.com/questions/57974137/how-to-add-custom-content-after-the-tab-section-and-before-you-may-also-like */
  52. wc-add-btn-see-separate-parts.php
    /** * Adicona botão: See separate parts * */
  53. wc-add-country-code-zipcode.php
    /** * Adiciona um script personalizado ao checkout e carrinho de compras do WooCommerce. * * Verifica se a página atual é a página de carrinho ou checkout antes de adicionar o script. * * @since 1.0 */
  54. wc-add-nif-checkout.php
    // Valide o campo NIF
  55. wc-get-child-attributes.php
    /** * The function `get_child_attributes_callback` retrieves child attributes (terms) of a given parent * attribute (taxonomy) in WooCommerce. * * @param attribute_name The parameter `attribute_name` is the name of the attribute for which you want * to retrieve the child attributes. * * @return an array of child attributes. Each child attribute is represented as an associative array * with keys 'name', 'slug', 'term_id', and 'taxonomy'. */
  56. wc-no-purchase.php
    /** * Coleção de funções para transformar o woocommerce em um catálogo de produtos */