I want to customize woocommerce theme MyStile.
How do I change the top menu "item" (items) to Stück?
This can be changed by:
Go to Appearance -> Editor and find the file theme-woocommerce.php
Open that file and find this line
echo '<span class="contents">' . sprintf(_n('%d item', '%d items', $woocommerce->cart->get_cart_contents_count(), 'woothemes'), $woocommerce->cart->get_cart_contents_count()) . '</span>';
Change "item" and "items" to "Stück".
Save the file and it should be changed.
Related
I am trying to display a set of custom fields on WooCommerce Vendor pages via Advanced Custom Fields. For the base vendor functionality, I am using the following plugin: https://woocommerce.com/products/product-vendors/
I have added the custom fields under ACF Field Groups and set the display rules to "Taxonomy » Vendors". With this in place, the custom fields are displaying within each individual "Edit Vendor" dashboard.
Within the vendor plugin files I have found where I would like to display the custom fields, which is on line 210 of the file WooCommerce Product Vendors / includes / woocommerce-product-vendors/includes/class-wc-product-vendors-vendor-frontend.php
Initially I tried using the following basic ACF code to display the custom fields, to no avail:
<p id="sample"><?php the_field('field_name'); ?></p>
I have also tried saving the field as a variable and then displaying it, again to no avail:
<?php
$variable = get_field('field_name');
echo '<p>' . $variable . '</p>';
?>
In both of these examples, the <p> wrapping elements are showing up on the front end, but the custom fields/variables are not.
One interesting thing I found is that when I use ACF to create an additional options panel within the WordPress dashboard, I am then easily able to display these variables from the options panel within the vendor pages. Following is the functions.php code I use to create this options panel:
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Additional Theme Options',
'menu_title' => 'Additional Theme Options',
'menu_slug' => 'additional-Theme-options',
'capability' => 'edit_posts',
'redirect' => false
));
}
And then within the plugin file referenced as above, if I insert the following script it displays the options panel fields perfectly:
<?php the_field('sample_option_field', 'option'); ?>
The problem with the options panel route is that these are then global, singular variables and not registered on a per-vendor basis.
Thanks!
Thanks Fresz, defining the terms worked perfectly. Following is the code I inserted into the plugin file to properly display the custom fields from the Vendor taxonomy:
// get the current taxonomy term
$term = get_queried_object();
// vars
$vendorphoto = get_field('vendor_secondary_photo', $term);
$street = get_field('vendor_street', $term);
$city = get_field('vendor_city', $term);
$state = get_field('vendor_state', $term);
$zip = get_field('vendor_zip', $term);
echo '<img src="'.$vendorphoto.'">';
echo '<p id="sample">'.$street. "<br />" .$city. ", " .$state. " " .$zip.'</p>';
I am in need to create wordpress shortcode of portfolio with multiple features for the customers to select and after that i am want to integrate with visual composer.
Thanks in advance.
Though very basic, this is what I've done recently to add a element block to Visual Composer in the form of a shortcode:
<?php
// Shortcode function to insert a 'read more' button in VC
function insert_readmore($atts){
extract(shortcode_atts(array(
'link' => '#',
'text' => 'Read more',
'align' => 'left'
), $atts));
$readmore = "<p>" . $text . "</p>";
return $readmore;
}
function register_shortcodes() {
add_shortcode('btnreadmore', 'insert_readmore');
}
add_action( 'init', 'register_shortcodes');
?>
After this I mapped the shortcode
[btnreadmore link=http://google.com align=right text=More]
in the Visual Composer settings. Once mapped, Visual Compser adds a new tab in the 'add element' screen that you can insert in a Visual Composer column.
I'm having some problems receiving data from the ACF plugin inside a plugin.
I'm using owl carousel to display a slideshow but i would like to add some extra text fields per image.
I created 2 caption fields in ACF and linked them to the post type of Owl Carousel.
implemented the fields inside the Owl Carousel main php file like so:
$caption1 = get_field('owl_caption1');
$caption2 = get_field('owl_caption2');
$loop = new WP_Query($args);
while ($loop->have_posts()) {
$loop->the_post();
$the_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $type);
$result .='<div class="item"><img title="' . get_the_title() . '" src="' . $the_url[0] . '" alt="' . get_the_title() . '"/><p>'.$caption1.'</p><p>'.$caption2.'</p></div>';
I also added the include line to the top of this document (plugins/owl-carousel/owlcarousel.php) to receive the date but when i fill in the fields they are not displaying
include_once('advanced-custom-fields/acf.php' );
The Faq of ACF states that you need to include the files inside your theme (themes/themename/advanced-custom-fields) or plugin (plugins/owl-carousel/advanced-customfields) so i tried copying the acf folder to my theme folder and the Owl Carousel plugin folder but i can't seem to receive the data.
Thanks in advance!
I am using customizr theme, I want to show both a logo and a title in header part. but I can show only one item at a time. as per this documentation http://www.themesandco.com/customizr/ theme set title if there is no logo. I want to show both, is there any way for this ? I want to show logo and on left side a company name. plz help
you can use a the *__after_logo* hook with the following code. (to copy and paste in your functions.php file of your child theme or your theme).
add_action( '__after_logo' , 'display_my_site_title');
function display_my_site_title() {
//first checks if there is a logo uploaded
$logo_src = esc_url ( tc__f( '__get_option' , 'tc_logo_upload') ) ;
if ( empty($logo_src) )
return;
//then print the site title after
printf('<h1><a class="site-title" href="%1$s" title="%2$s | %3$s">%4$s</a></h1>',
esc_url( home_url( '/' ) ),
esc_attr( get_bloginfo( 'name') ),
esc_attr( get_bloginfo( 'description' ) ),
esc_attr( get_bloginfo( 'name') )
);
}
The code has been tested and works. (you have to have at least v3.0.14 of the theme)
I hope this will be useful.
You will need to adjust the following file:
customizr\parts\class-header-header_main.php
You're right that it will show the title or the logo, as per comment in the file:
LINE 115 The template for displaying the title or the logo
I have built a very simple plugin and uploaded it on my wordpress account which is run on localhost. Once I activate it, its output will be shown on every page, and it wont be added to the left hand side menu of wordpress. what should I add to it to be added to the menu? I suppose it should be done using add_action but do not know how !!
<?php
/*
Plugin Name: myphotos Plugin
Description: A simple wordpress plugin.
Version: 1.0
Author: Saeed Pirdost
Copyright: 2012, Saeed Pirdost
*/
?>
<?php
add_filter('admin_notices','myprint');
?>
function myprint()
{
echo "hello";
}
?>
I used the following code as well but when I activate the plugin just a white page will be shown.
add_menu_page(__('My Menu Page'), __('My Menu'), 'edit_themes', 'my_new_menu', 'myprint', '', 7);
First, stop opening and closing PHP tags at every line, you don't need that. This is used when some HTML is happening in the middle of your PHP.
Also, the last closing ?> of a PHP file can/should be omitted. It may even break a site if there is a white-space after it...
Refer to WordPress_Coding_Standards.
Second, you need to decide if you want to use the function my_print as callback of admin_notices or of add_menu_page. Can it be both? In this case, yes, but really, do it only if you know what you are doing.
Your plugin is breaking because add_menu_page cannot be called directly.
Always check the documentation of each function that don't work as expected:
Function_Reference/add_menu_page
Here's a working version of your plugin:
<?php
/*
Plugin Name: myphotos Plugin
Description: A simple wordpress plugin.
Version: 1.0
Author: Saeed Pirdost
Copyright: 2012, Saeed Pirdost
*/
add_filter( 'admin_notices', 'print_my_notice' );
add_action( 'admin_menu', 'register_custom_menu_page' );
function print_my_notice()
{
echo '<div class="updated">
<p>I am a big notice that appears everywhere</p>
</div>';
}
function register_custom_menu_page()
{
add_menu_page(
__( 'My Menu Page', 'my-plugin-text-domain' ),
__( 'My Menu', 'my-plugin-text-domain' ),
'edit_themes',
'my_new_menu',
'print_my_menu',
'http://upload.wikimedia.org/wikipedia/commons/a/aa/Wink%2816px%29.svg',
7
);
}
function print_my_menu()
{
echo '<div id="icon-post" class="icon32"></div>
<h2>My plugin</h2>
<p><a class="button-secondary" href="#"> '
. __( 'I am a translation', 'my-plugin-text-domain' )
. '</a>
</p>';
}
Open your wordpress Admin Area
Click on appearance->widgets
Drag and drop the Menu to desired place
Or
Click Appearance -> Menu
and click on sidebar menu
and add items there
Hope it helps