Is there any module that integrate Telr with wordpress? If yes how can I integrate? or else how can I create a new plugin from scratch to manage the payment
via Chebli Mohamed
Is there any module that integrate Telr with wordpress? If yes how can I integrate? or else how can I create a new plugin from scratch to manage the payment
Is there any authentication for appPresser as in Wordpress? Please explain? Thanks in Advance.
we have been using a plugin on a website for over a year but for some reason the shortcode is now outputting as a plain text, so actually showing the shortcode itself. The shortcode should produce a product slider.
the plugin in question is: WPB WooCommerce Product slider
The website is: http://ift.tt/29oezrk
The entire page was created inside the WYWYG editor inclusive of the shortcodes. Im unfortunately in a position where I cant start disabling the plugins to identify if theres a conflict.
I have been looking all over the web, I did check out the shortcodes.php file thats included witihn the plugin and I can see in there:
add_shortcode('wpb-latest-product', 'wpb_wps_shortcode');
if( !function_exists( 'wpb_wps_shortcode' ) ):
function wpb_wps_shortcode($atts){
extract(shortcode_atts(array(
'title' => __( 'Latest Products','wpb-wps' ),
), $atts));
$return_string = '<div class="wpb_slider_area wpb_fix_cart">';
$return_string .= '<h3 class="wpb_area_title">'.$title.'</h3>';
$return_string .= '<div id="wpb-wps-latest" class="wpb-wps-wrapper owl-carousel '.wpb_ez_get_option( "wpb_slider_type_gen_lat", "wpb_wps_style", "grid cs-style-3" ).'">';
$args = array(
'post_type' => 'product',
'posts_per_page' => wpb_ez_get_option( 'wpb_num_pro', 'wpb_wps_general', 12 )
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
global $post, $product;
$return_string .= '<div class="item">';
$return_string .= '<figure>';
$return_string .= '<a href="'.get_permalink().'" class="wpb_pro_img_url">';
if (has_post_thumbnail( $loop->post->ID )){
$return_string .= get_the_post_thumbnail($loop->post->ID, 'shop_catalog', array('class' => "wpb_pro_img"));
}else{
$return_string .= '<img id="place_holder_thm" src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />';
}
$return_string .='</a>';
$return_string .='<figcaption>';
$return_string .='<h3 class="pro_title">';
if (strlen($post->post_title) > 20) {
$return_string .= substr(the_title($before = '', $after = '', FALSE), 0, wpb_ez_get_option( 'wpb_title_mx_ch', 'wpb_wps_style', 10 )) . '...';
}else{
$return_string .= get_the_title();
}
$return_string .='</h3>';
if( $price_html = $product->get_price_html() ){
$return_string .='<div class="pro_price_area">'. $price_html .'</div>';
}
$return_string .= '<div class="wpb_wps_cart_button"><a href="'.esc_url( $product->add_to_cart_url() ).'" rel="nofollow" data-product_id="'.esc_attr( $product->id ).'" data-product_sku="'.esc_attr( $product->get_sku() ).'" data-quantity="'.esc_attr( isset( $quantity ) ? $quantity : 1 ).'" class="button '. ($product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '') .' product_type_'.esc_attr( $product->product_type ).'">'.esc_html( $product->add_to_cart_text()).'</a></div>';
$return_string .='</figcaption>';
$return_string .= '</figure>';
$return_string .= '</div>';
endwhile;
} else {
echo __( 'No products found','wpb-wps' );
}
wp_reset_postdata();
$return_string .= '</div>';
$return_string .= '</div>';
wp_reset_query();
return $return_string;
}
endif;
The shortcode I am using is [wpb-latest-product title=”Latest Product”]
I am seeing if anyone else has encountered this? Or what the best steps are to diagnose such issues.
Also, I tried adding the shortcode in the 'text' tab rather than the 'visual' tab but had no effect.
I'm trying to edit the WordPress TinyMCE editor so all the links has the target = "_blank". I've tried with jquery to set the 'Open link in new tab' checkbox to be always checked but, no results. Thank you
I'm using the WP-Property and WP-Property: Importer plugins to manage properties on a WordPress powered website. The importer uses xpath rules to help map fields in an imported XML file to their corresponding field on the site.
e.g. 'Display Address' maps to 'address/full'
I have a set of elements that look like this:
<property>
<feature1>Feature</feature>
<feature2>Feature</feature>
<feature3>Feature</feature>
<feature4>Feature</feature>
<feature5>Feature</feature>
<address>
<full>abc</full>
<street>def</street>
<postcode>ghi</postcode>
</address>
</property>
I want to group these together into one entry rather than setting up separate fields for each one, so I'm looking for a means to match feature* but everything I've tried so far seems to have missed the mark. Goes without saying that I've never dabbled with xpath before today!
The default Woocommerce search input I'm using is:
<div class="postcode-search col-lg-4 col-lg-offset-4">
<input type='textbox' name="s" class="form-control form-inline" style="display: inline;" id="item-search" value="<?php the_search_query();?>" placeholder="Enter your postcode"/>
<span class="input-group-btn">
<button class="item-search-btn"><span class="">find stores</span></button>
</span>
<?php
if ( function_exists( 'woocommerce_product_search' ) ) {
echo woocommerce_product_search( array( 'limit' => 40 ) );
}
?>
</div>
The problem I'm having is that the results page displays the text and the 'leave a comment' link below:
Whereas I want the results to be displayed with the thumbnail as such:
Does anyone know how I can achieve this result? All suggestions welcome and thank you in advance!
In Woocommerce I'm trying to find a way to apply a 20% discount to the first order made by a new customer. It appears that I can use the functions woocommerce_after_checkout_validation and check_new_customer_coupon to do this but it doesn't work.
Here is my code from function.php:
add_action('woocommerce_after_checkout_validation','check_new_customer_coupon', 0);
function check_new_customer_coupon(){
global $woocommerce;
// you might change the name of your coupon
$new_cust_coupon_code = 'test';
$has_apply_coupon = false;
foreach ( WC()->cart->get_coupons() as $code => $coupon ) {
if($code == $new_cust_coupon_code) {
$has_apply_coupon = true;
}
}
if($has_apply_coupon) {
if(is_user_logged_in()) {
$user_id = get_current_user_id();
// retrieve all orders
$customer_orders = get_posts( array(
'meta_key' => '_customer_user',
'meta_value' => $user_id,
'post_type' => 'shop_order',
'numberposts'=> -1
) );
if(count($customer_orders) > 0) {
$has_ordered = false;
$statuses = array('wc-failed', 'wc-cancelled', 'wc-refunded');
// loop thru orders, if the order is not falled into failed, cancelled or refund then it consider valid
foreach($customer_orders as $tmp_order) {
$order = wc_get_order($tmp_order->ID);
if(!in_array($order->get_status(), $statuses)) {
$has_ordered = true;
}
}
// if this customer already ordered, we remove the coupon
if($has_ordered == true) {
WC()->cart->remove_coupon( $new_cust_coupon_code );
wc_add_notice( sprintf( "Coupon code: %s is only applicable for new customer." , $new_cust_coupon_code), 'error' );
return false;
}
} else {
// customer has no order, so valid to use this coupon
return true;
}
} else {
// new user is valid
return true;
}
}
}
I have options menu in wordpress.
I have option where you can put number.
$num_opts = 'num_opts';
$hidden_num_opts = 'return_num_opts';
$num_opts_field = 'num_opts';
$num_opts_value = get_option( $num_opts );
so I get options value from db
if(( isset($_POST[ $hidden_num_opts ]) && $_POST[ $hidden_num_opts ] == 'Y' ){
$num_opts_value = $_POST[ $num_opts_field ];
update_option( $num_opts, $num_opts_value);
}
and if value changes we save it to db.
and here is the form. Values get updated when save is pressed. Page gets reloaded and new value is shown in field.
<form name="options_form" method="post" action="">
<input type="hidden" name="<?php echo $hidden_num_opts; ?>" value="Y">
<p><?php _e("Number of options:", 'x' ); ?>
<input type="text" name="<?php echo $num_opts_field; ?>" value="<?php echo $num_opts_value; ?>" size="5">
</p><hr />
<?php
$options = array();
for ($opts = 1; $opts <= $num_opts_value; $opts++){
array_push($options,$opts);
}
foreach ($options as $option) {
$opt_val = get_option($option);
echo '<input type="hidden" name="hidden_' . $option . '" value="Y">';
echo '<br>';
printf( __('Option %s', 'x'), $option);
echo '<br>';
echo '<input type="text" name="' . $option . '" value="'. $opt_val .'" size="10">';
echo '<br>';
if(( isset($_POST[ 'hidden_'.$option ]) && $_POST[ 'hidden_'.$option ] == 'Y' )){
update_option($option, $_POST[$option]);
}
}
unset($option);
?>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
</p>
</form>
Based on number inserted in first field I create other field. So if we enter 5 when page reloads we get 5 new input fields. We can enter text in it and when we press save everything is saved in db. So we get field id of option name and value of option value.
But page reloads and values aren't shown. When I reload page again value shows.
So for the 1st input I type x and x is saved in db but in input field nothing is shown. When I reload page x is shown. If I then write b instead of x I got b saved and x shown until I reload page. If I don't reload page and just enter new value page gets reloaded and old value is shown.
Any tips?
I'm trying to find a solution for changing Wordpress menu as it shown on example image. I have a problem with design, how to make child menu float from dropdown item? And also how to make it dropdown on click only?
Thanks in advanced!
.nav li ul {
visibility: hidden;
z-index: 9999;
position: fixed;
width: 100vw;
left: 0;
padding: 0;
text-align: right !important;
border: none;
background: #7bc5f7;
box-shadow: none;
}
.nav li.et-reverse-direction-nav li ul {
right: 0;
top: auto;
background: #bae1fc;
}
#top-menu li li a {
width: 100%;
}
I use xmlrpc for uploading image to my wordpress site. This images only i going use for another mysql table not in post. i use following code
$rpcurl='http://ift.tt/298qxca';
$username='admin';
$password='pass5';
$blogid=get_current_blog_id(); //Post ID
$file=file_get_contents('file:///C:/Users/webway/Desktop/ff/2.jpg');
$filetype = "image/jpeg";
$filename = "remote_filename.jpg";
xmlrpc_set_type($file,'base64'); // <-- required!
$params = array($blogid,$username,$password,
array('name'=>$filename,'type'=>$filetype,'bits'=>$file,'overwrite'=>false));
$wpdb->insert('wp_bwbps_images', array('image_name' => $filename,'user_id' => '1','gallery_id' => '4'));
$request = xmlrpc_encode_request('wp.uploadFile',$params);
$result = go($request,$rpcurl);
print_r($result);
function go($request,$rpcurl){
$ch = curl_init();
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_URL,$rpcurl);
curl_setopt($ch,CURLOPT_POSTFIELDS,$request );
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
}
After upload i insert image name to another table
$wpdb->insert('wp_bwbps_images', array('image_name' => $filename,'user_id' => '1','gallery_id' => '4'));
Problem is i also enabled 'overwrite'=>false . so if image name is same upload saveed as image_1.jpg like this
What i need is after image upload i need get saved file name using xmlrpc.php so only i can add that file name in to my custum table..
Any other way?
Hello Currently i am using Simple weather JS (http://ift.tt/ZDU7Gn) in my wordpress theme for showing live weather and also for options i am using redux framework. i've create a text field for "Name of your City" and my Option Unique ID is > " cpv-hm-cat-op-8 ". Preview of My Redux framework option is below.
array(
'id' => 'cpv-hm-cat-op-8',
'type' => 'text',
'title' => __( 'Name of your city', 'redux' ),
'desc' => __( 'Write your city which you want to show in weather', 'redux' ),
'default' => 'New York',
),
Now i want to use that option in my simple weather JS file and i want my output, when i input name of my city its show in weather of that city. simple weather js option look like =>
$.simpleWeather({
location: 'New Jersey',
woeid: '',
unit: 'c',
success: function(weather) {
html = '<h2><i class="symbol-weather icon-'+weather.code+'"></i> '+weather.temp+'°'+weather.units.temp+'</h2>';
html += '<ul><li>'+weather.city+'</li>';
$("#weather").html(html);
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
Here "Location" i want to add my redux plugin option. but its not working.
$.simpleWeather({
location: '<?php global $cpv; echo $cpv['cpv-hm-cat-op-8'];?>',
Kindly Help me how can i add there my redux framework option.
I am looking at trying to get all the posts which contain a certain name and the code I have is half working. It pulls through standard posts but not sure how to get it to show all the custom post types as well.
Here is the code in the functions.php
add_filter( 'posts_where', 'wpse18703_posts_where', 10, 2 );
function wpse18703_posts_where( $where, &$wp_query )
{
global $wpdb;
if ( $wpse18703_title = $wp_query->get( 'wpse18703_title' ) ) {
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( $wpdb->esc_like( $wpse18703_title ) ) . '%\'';
}
return $where;
}
Here is the code which then uses that function to find posts of that name.
<div class="main-content large-8 medium-8 small-12 columns">
<h2><?php the_title(); ?> News and Features</h2>
<?php
$title = $wp_query->post->post_title;
$query = new WP_Query(
array(
'wpse18703_title' => "$title",
'posts_per_page' => 10,
'post__not_in' => array($post->ID),
'post_type' => array('post', 'it_review')
)
);
if ($query->have_posts()){
while ( $query->have_posts() ) { $query->the_post(); ?>
<div class="small-12 large-12 gdb-news-container">
<div class="small-12 large-4 columns gdb-news-image">
<?php the_post_thumbnail(); ?>
</div>
<div class="small-12 large-8 columns">
<h3><?php the_title(); ?></h3>
<?php echo content(20); ?>
</div>
<div class="clearfix"></div>
</div>
My ideal scenario would be to use just the title of the game for example Fallout 4 and it shows all posts containing that in the title.
I have a wordpress site that is currently up and functional, but I need to add a full non-wordpress site on top of it so that:
I'm guessing it would help if you can get a look at the site.
The site in question is http://www.pos.com. Notice that when you do http://pos.com (without the www), it goes to the page it's supposed to go to, but when you click on "more info" and click on an icon, it tries to go into the wordpress part and do a search.
You can also see that when you try going to http://ift.tt/292dusl, it redirects properly, but when you try http://ift.tt/292W7Ek, it doesn't.
Both sites are working fine in itself, but once I combine them, that's where all the issues arise. Currently this is what I have so far for the rewrites.
Options -MultiViews
Options +FollowSymlinks
IndexIgnore */*
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?domain.com [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ home.php [L]
# I'm trying to redirect both domain.com and www.domain.com root to home.php.
# There are some icons that the use will select that will in turn reload the page and include partial files with content.
RewriteRule ^site/(.*)$ page.php?&page=$1 [L]
# Site specific static files are routed to page.php with the page variable being used to pull that specific partial file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(retail\-pos\-for\-growth)/([^/]+)$ home.php?size=growth&industry=retail&friendly=$1&type=$2 [L]
RewriteRule ^(hospitality\-pos\-for\-growth)/([^/]+)$ home.php?size=growth&industry=hospitality&friendly=$1&type=$2 [L]
RewriteRule ^(retail\-pos\-for\-enterprise)/([^/]+)$ home.php?size=enterprise&industry=retail&friendly=$1&type=$2 [L]
RewriteRule ^(hospitality\-pos\-for\-enterprise)/([^/]+)$ home.php?size=enterprise&industry=hospitality&friendly=$1&type=$2 [L]
# Any requests that match above should redirect to home.php with those get variables. The page will include the respective content files.
# Default Wordpress Rewrites
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Maybe I'm not explaining it too well, so if you have any further questions please let me know.
Thanks in advance.
It seems with version 2.6 WooCommerce have changed the way endpoints and custom profile tabs are made. More infor here http://ift.tt/1NDtw5i and and http://ift.tt/294lIlh
My code bellow is almost similar to the one in these links but clicking on the new profile tab keeps showing the 404 Not Found error. I tried Permalinks refresh and flush_rewrite_rules()
but othing seems to work....
if ( !class_exists('My_WC_User_Company') ) {
class My_WC_User_Company {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-company';
/**
* Plugin actions.
*/
public function __construct() {
// Actions used to insert a new endpoint in the WordPress.
add_action( 'init', array( $this, 'add_endpoints' ) );
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
// Change the My Accout page title.
add_filter( 'the_title', array( $this, 'endpoint_title' ) );
// Insering your new tab/page into the My Account page.
add_filter( 'woocommerce_account_menu_items', array( $this, 'new_menu_items' ) );
add_action( 'woocommerce_account_' . self::$endpoint . '_endpoint', array( $this, 'endpoint_content' ) );
}
/**
* Register new endpoint to use inside My Account page.
*
* @see http://ift.tt/29elPY7
*/
public function add_endpoints() {
add_rewrite_endpoint( self::$endpoint, EP_ROOT | EP_PAGES );
}
/**
* Add new query var.
*
* @param array $vars
* @return array
*/
public function add_query_vars( $vars ) {
$vars[] = self::$endpoint;
return $vars;
}
/**
* Set endpoint title.
*
* @param string $title
* @return string
*/
public function endpoint_title( $title ) {
global $wp_query;
$is_endpoint = isset( $wp_query->query_vars[ self::$endpoint ] );
if ( $is_endpoint && ! is_admin() && is_main_query() && in_the_loop() && is_account_page() ) {
// New page title.
$title = __( 'My Company', 'domain' );
remove_filter( 'the_title', array( $this, 'endpoint_title' ) );
}
return $title;
}
/**
* Insert the new endpoint into the My Account menu.
*
* @param array $items
* @return array
*/
public function new_menu_items( $items ) {
// Remove the logout menu item.
$logout = $items['customer-logout'];
unset( $items['customer-logout'] );
// Insert your custom endpoint.
$items[ self::$endpoint ] = __( 'My Company', 'domain' );
// Insert back the logout item.
$items['customer-logout'] = $logout;
return $items;
}
/**
* Endpoint HTML content.
*/
public function endpoint_content() {
ob_start();
// here is some content ?>
<?php
$output = ob_get_clean();
echo $output;
}
}
}
add_action('init', '_action_ssd_wp_user_company_init');
if( !( function_exists('_action_ssd_wp_user_company_init')) ){
function _action_ssd_wp_user_company_init(){
if ( get_current_user_id() && get_user_meta( get_current_user_id(), 'user_company', true ) == 'yes' ) {
new My_WC_User_Company();
}
}
}
Does anyone have any ideas what couldbe the issue?
I am looking for a tool to track which users didn't receive or didn't open their Woocommerce order complete email (maybe because they didn't check their Spam filter).
I found the Follow-Ups Woocommerce extension, but this only lets you track additional emails and doesn't show you a list of all people that didn't open their mail.
Is there any other way to track Woocommerce Emails as described?
I am Using the following code to refresh the webpage at particular interval. The page seems to refresh but the Google Analytics code is not getting loaded. I have the Google Analytics code also for reference below. I am still a newbie to coding, Would be really great if you could help figure out why the Analytics code is not loading.
Refresh Code
<script type='text/javascript' src='http://ift.tt/292atIw'></script>
<script type="text/javascript">
function refresh_handler() {
function refresh() {
var url = $(location).attr('href');
window.history.pushState("", "<?php echo $meta_title; ?>", url);
$("#ajaxanalytics").load("http://ift.tt/292ThPu");
}
setInterval(refresh, 60*1000); //every 1 minutes
}
$(document).ready(refresh_handler);
</script>
Analytics Code
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://ift.tt/1pxBd1V','ga');
ga('create', 'UA-XXXXXX-X', 'auto');
ga('send', 'pageview');
</script>
I am trying to insert a link to toggle the comment_form using jQuery onclick, but it does not work ...
In my comments.php , I added the following html around the comment_form() :
<p>BEFORE FORM</p>
<a style="cursor:pointer" onclick="jQuery('#add-comment).toggle();">Toggle comment-form</a>
<div id="add-comment" style:"display:none;">
<?php $comments_args = array(
....
);
comment_form($comments_args);
?>
<p>AFTER FORM</p>
</div>
and to be sure jQuery is loaded, I added the following code in my functions.php
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
the link is correctly displaed but the form is not hidden and the toggle does not activate .. where am I wrong ?
thanks for feedback
I want to show Woocommerce generated Order Reports on another page of my site. They should be visible to a user when he visits that page, rather than the admin panel.
I'm guessing I'll have to extract the jQuery Code and of the graphs from the admin panel of woocommerce and then use it on some other page.
If got this full screen background slider (Vegas) on a site thats using Wordpress. Now the slider is called using this script:
<script>
$("body").vegas({
delay: 7000,
timer: false,
shuffle: true,
transition: 'fade',
transitionDuration: 2000,
slides: [
{ src: "photo01.jpg" },
{ src: "photo02.jpg" },
{ src: "photo03.jpg" },
{ src: "photo04.jpg" }
],
overlay: '01.png'
});
</script>
Within Wordpress it is possible to make a loop which "loops" the content that is in that file. What I would like to do is something like this:
....
slides: [
<?php get_template_part('loop-backgrounds'); ?>
{ src: "some-file-to-stop-the-backgrounds.jpg" }
],
....
The loop-backgrounds
would look something like this:
<?php $loop = new WP_Query( array( 'post_type' => 'backgrounds', 'posts_per_page' => -1, 'orderby'=>'id', 'order' => 'ASC') );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
{ src: <?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ;?> },
<?php endwhile; wp_reset_query(); ?>
This some-file-to-stop-the-backgrounds.jpg
doesn't have a ,
at the end so it wouldn't break the code (i think). Is this at all possible?
site content shows in chinese on chrome and mozilla and on mobile also but shows in english on explorer.
I have tried to force the language in wp-config.php to en-US but still having this abnormalities.
How can I solve this problem.
I am very frustrated now. I have a php script sync.php in the following absolute path folder.
home2/**username**/public_html/**mystore.net**/wp-content/plugins/pets/admin/sync.php
On running the sync.php
file manually, it works perfectly. So the php script is not the problem.
My cron command reads php -q /home2/**username**/public_html/pets/admin/sync.php
This is a hostgator server if this helps. The email returns - No input file specified.
I would really appreciate anyone helping me out with this.
Cheers, RakeshD
I copied my wordress site to an AWS instance. My home page is working fine, but the pages are not working properly. It is giving me a 404 error.
Not Found
The requested URL /some-page/ was not found on this server.
Apache/2.2.31 (Amazon) Server at example.com Port 80
Does anyone know why this is?
I´m trying to add some custom values to the wordpress RSS feed. For testing purposes I got this code:
function add_custom_fields_to_rss() {
return "<test>test</test>\n";
}
add_action('rss_item', 'add_custom_fields_to_rss');
add_action('rss_item2', 'add_custom_fields_to_rss');
I have placed this to the bottom of my themes function.php
. When I now try to get the rss with http://example.com/feed there is no test content which I returned in my custom function.
Does anybody know why
By default Woocommerce saves the billing and shipping address on the checkout page.
I am searching for a way to prevent Woocommerce from saving the values in the shipping address. So all the fields in the shipping address should be empty.
In another thread I found a partial solution. It works great, but it also makes the billing address empty:
add_filter('woocommerce_checkout_get_value','__return_empty_string',10);
Is there a way to do this only for shipping address?
Big thx!
The above two function not working in wordpress. I want to download file and i am running wordpress in xampp also i have tried it in another online server with wordpress framework still not working.
but this is working in another online server where i have not used wordpress framework.
Is there is problem with wordpress using the above two function?
header("Content-Type: application/zip")
header("Content-Disposition: attachment; filename=$fileName");
So, a site of my was recently hacked and now has 50,000 indexed url.Almost all the links are un-natural links and I would like to get rid of them. They are currently redirecting to 404 page
Now I want to remove all the un-natural site and keep only my 500 natural links. So I've read many articles saying 410 redirect or disvow links from google.
Could you guys let me know which one works best?
Also do I have to re-crawl after the 410 redirect or after I have submitted the links for disvow?.
Additional info: The website runs on WordPress
I have paid for a theme.I have a license key for my theme. But when I click 'Active License' nothing happens ,I want to get pro feathers ! Anyone here who can help me ?
My web works fine, but the RSS doesn't seem to works for some reason and FeedValidator give me this:
Server returned HTTP Error 503: Service Temporarily Unavailable
This was like this since a half a year. Does anyone knows how to solve this?
I'm using Woocommerce REST API V3 and I want to get a custom JSON callback that is based on a specific element's meta_data (has badge / doesn't have).
If the element has id:14425
- return 1 (it has a badge).
If the element has id:Select badge
- return 0 (doesn't have).
This is how metadata looks (I printed it on page just to see the values structure):
[my_product_badge] => Array ( [0] => a:1:{s:2:"id";s:5:"14425";}
Code in wc-api-products.php
file (I deleted most of unrelated piece of codes to make it easier to read) :
private function get_product_data( $product ) { $prices_precision = wc_get_price_decimals(); return array( 'has_badge' => metadata_exists( 'post', $product->id, 'my_product_badge' ) ? (int) get_post_meta( $product->id, 'my_product_badge', ['id'] && is_numeric , true ) : 0, ); }
This is not working :(
Any ideas?
I am trying to redirect all pages coming under
to
and what to keep the directory url accessible as the directory url also contain content which I need to display and i used this htaccess code
RewriteRule ^/directory/(.*)$ /directory/supplier/$1 [L,R=301,NC]
but it's not working.
I have a website which is loading Maximage in the footer with a few other scripts. All these work well and have since I built my site, but a third party wordpress plugin from Axcelerate (an online student and courses api) comes up with an error, which I can only remedy by removing the jquery link at the end of the html page.
The problem comes up when going through the booking process found by clicking "Book Now" on this page Course Page and then clicking "new user" and "next".
The error comes up as,
VM10448:34 Uncaught TypeError: $(...).validate is not a function
I have tried other versions of jquery, alternate load methods, changing how wordpress loads its javascript and also moving my websites javascript to the head instead of the footer. Now I am a bit stuck and don't know what other avenues to look into to get this functioning.
I wanted to add my blog, which is hosted in a different server, to my main website under subdirectory /blog.
The proxy through nginx went well
location /blog/ {
proxy_pass http://107.170.8.156/;
}
I added also those lines to config.php
define( 'WP_SITEURL', '/blog' );
define( 'WP_HOME', '/blog' );
$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);
It works fine, however it fails to load css and js files
I searched everywhere on the Internet and I am not able to find any solution.
I have this extremely strange error that only happens when people try to order. Guests come onto our site and add stuff to their cart. Then they proceed to go to the checkout. On checkout when they click proceed to paypal they get the following error: "We were unable to process your order, please try again.". However on reloading the page the error is gone when they try to recheckout. No plugins or themes are conflicting as I checked all of them.
I did some debugging and I noticed that the reason the error is thrown is because of the function: wp_verify_nonce() I did some further debuging and found out that during the first time the user tries to checkout the above function is called. And returns false because the nonce is different when compared to what is currently hashed. However on the second checkout the above function returns true because the nonce is correct. This means that for some reason my nonce is wrong the first time. Does anyone know why?
I'm getting this problem on the following function: process_checkout() When the following command is run:
if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-process_checkout' )) {
WC()->session->set( 'refresh_totals', true );
throw new Exception( __( 'We were unable to process your order, please try again.', 'woocommerce' ) );
}
I tried my best to explain my issue but does anyone know why my nonce is wrong during checkout on the first time?
When i change footer text from gui doesn't change and i can't change it from code manual, am tried to change it from functions.php or disable it but i can't. how to disable or edit footer? and this footer code
<?php
/**
* After main part - action
*/
do_action('kleo_after_main');
?>
</div><!-- #main -->
<?php get_sidebar('footer');?>
<?php
/**
* After footer hook
* @hooked kleo_go_up
* @hooked kleo_show_contact_form
*/
do_action('kleo_after_footer');
?>
</div><!-- #page -->
<?php
/**
* After page hook
* @hooked kleo_show_side_menu 10
*/
do_action('kleo_after_page');
?>
<!-- Analytics -->
<?php echo sq_option('analytics', ''); ?>
<?php wp_footer(); ?>
I moved a site from here:
to here:
Running off the ip address the anchor tags that can be selected from the 'select a ladder type' menu work fine. But on the live site they do not.
I'm completely confused as to why this is not working as a anchor tag is very simple.
Any assistance would be greatly appreciated.
So I'm using Timber v0.22.5. I have it currently running on my local and a dev environment right now. Everything is running great no issues. Both environments are running PHP 5.5.9.
I just migrated it to my production server which is running PHP 7.0. I am now getting the following error from Timber.
Fatal error: Uncaught Error: Cannot access property started with '\0' in /var/www/html/wp-content/plugins/timber-library/lib/timber-core.php:67
I'm not sure what exactly else is different between the environments other than different versions of PHP. I cannot update to Timber v1 because well the guide seems to suggest not doing that because of some backwards compatibility issues.
I'm going to try installing PHP 5.5.9 and see if that does the trick but was wondering if anyone else was having this issue.
Thanks!
I'm trying to import images from a remote server and set it to custom fields. Importing and generating a attachment id is working, but something is messing with the custom fields. I don't know if is a thread issue or something.
Here's my code:
$sql = 'SELECT * FROM produto';
$retval = mysql_query( $sql, $connection) ;
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
$file = $row['imagem'];
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
'post_content' => '',
'post_status' => 'inherit'
);
$attachment_id = wp_insert_attachment( $attachment, $upload_file['file'], $parent_post_id );
$imgs[$row['modelo']][]['imagem'] = $attachment_id;
if (!is_wp_error($attachment_id)) {
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] );
wp_update_attachment_metadata( $attachment_id, $attachment_data );
}
}
}
foreach ($imgs as $key => $value) {
$args = array(
'post_type' => 'produto',
'meta_key' => 'identifier1',
'meta_value' => $key);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
update_field('imagens', $value, get_the_ID());
}
}
/* Restore original Post Data */
wp_reset_postdata();
}
If I try to set 20 itens on this custom field, it works perfectly. But when I need to run this loop with 250 results, it breaks.
What am I doing wrong?
Thanks!
I have setup a wordpress theme that uses featured images for header images on pages (I did this to make it easy for clients to modify on their own). Because the header image container needs to be a fixed size (100% width of the page and 300px heigh), I am using the "object-fit:cover" css callout which works perfect. The resulting effect is the image spans the full width of the page, and then is cropped vertically automatically (I did this so client would not need to manually size/crop the images before uploading them).
It works perfect with the exception of IE (of course). I have tried numerous possible workarounds from the "backgroundsize.htc" fix to javascripts, to absolute positioning and using the clip css feature, but it still does not give me the desired effect. IE insists on stretching the image. At this stage I am not sure if this is even doable in IE.
Here is my css for the featured image:
.wp-post-image {
width:100%;
height:300px;
position:relative;
display:block;
top:0px;
object-fit:cover;
}
img.wp-post-image {
max-height:300px;
margin:0 auto;
}
This code works in all browsers except IE, so I am using this code to feed IE overrides for the featured images:
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.wp-post-image {}
img.wp-post-image {}
}
Does anyone have advice for me as to how to force IE to "fill" the featured image container with its respective image and crop it instead of stretching it? Any help is really appreciated...
I have tried to remove the pagination from my post pages in wordpress:
domain/page/pageno which are actually posts.
Google is indexing them and it looks stupid to see results like "page/130" "page/131" etc.
I already have a dynamic set of page links with the full text in the footer - so the pagination is just a nuisance. What code do I need to remove/comment out to get rid of this?
I am using the twenty sixteen theme BTW. In case the code is theme specific.
I need to display the categories on my wordpress which has a parent and have sub categories under it. The main problem is that 'm having trouble displaying all the categories with full details with description and a unique div
on it for an image.
The ones I'm using right now is this. Reference for the string args for this method is here
<ul>
<?php wp_list_categories( array(
'title_li' => __( 'asd' ),
'hide_title_if_empty' => false,
'show_option_all' => false,
'use_desc_for_title' => true,
'child_of' => 2
) ); ?>
</ul>
It generates everything I need except that I need to display the description as a text below the title and create a div
to place an image on it.
<ul>
<li class="categories">asd
<ul>
<li class="cat-item cat-item-10"><a href="http://ift.tt/292iNEA">good</a>
</li>
<li class="cat-item cat-item-6"><a href="http://ift.tt/291C0tR">collections</a>
</li>
</ul>
</li>
</ul>
The second option that I have is this one. Basically its a custom way of generatng list of categories but not quite sure if I can able to only display the categories under the child of page id 2 which is the parent category. and also hide the element which is displaying how many post do I have on a category.
<?php
$categories = get_categories();
foreach ($categories as $cat) {
if ($cat->category_parent != 0) {
echo '<span style="padding-left:10px;">';
}
echo '<a href="'.get_option('home').get_option('category_base').'/'.$cat->category_nicename.'/">'.$cat->cat_name.'</a> ('.$cat->category_count.')';
if ($cat->category_description != '') {
echo ' - '.$cat->category_description;
}
if ($cat->category_parent != 0) {
echo '</span>';
}
echo '<br />';
}
?>
I'm working on creating a child theme in Wordpress and I'm a bit confused by a do_action('theme_header_content')
that is in place of the header content.
A wordmark and a few icons are placed into that section but I can't figure out how. I tried to use grep on plugins and themes directory to see where else theme_header_content
is called but that is the only place. I need to rearrange some content there.
How can I do this? How is the content arriving there? The theme came with some of it's own plugins but I can't seem to find anything relevant there, either.
Thank you
Visual Composer is not working in frontend and backend - stuck at loading screen
I check the Inspect Element > Console tab and this is the error
Uncaught TypeError: _.template(...).trim is not a function ... custom_views.js:81
i'm brazilian, I am new to creating websites , I made a page in php that works well using a script to load data from XML file.
This script loads - a Video , the video title and description every time you click a link from this xml file.
But when I went up the wordpress that does not work , the DIVS are empty as if it does not recognize the XML loaded by the GET function.
I wonder if it is to resolve this error , thank you.
I've been doing a lot of research for web development and googling, and I'm not sure how to search this question in google.
I've noticed some bigger and smaller sites have their websites "mywebsite.com" and have all their inner pages such as "mywebsite.com/about" or "mywebsite.com/videos"
Makes perfect sense to me. But then I come across some website that have a section(?) BEFORE the .com, for example "video.mywebsite.com" or "news.mywebsite.com"
I own a couple websites myself and I'm curious to why this is done, and what benefits this brings? Is it better for SEO?
If it is something that I could benefit from, how would I go about doing this if my websites are built in WordPress?
I'm needing to develop a website for a client and I need to know which way to go.
At first I was thinking have the client pay $5 per month for a Digital Oceal node.js server and I could use that system to 'host' the website myself (am I right? Please correctly me if I'm wrong here - seriously) then register the ip address and tie it to a domain name that will be registered to a domain name service.
OR
Use Wordpress to make my site from there with pure client side JavaScript (I could do it...right? I need correction here as well if I'm wrong) I do not know how to get, when a person goes to username.wordpress.com, some JavaScript inserted into that page and hook into the flow so I could take over with my code from there with React.js
Places to point me to get to the correct resources to get to for adding javascript to execute when a user navigates to username.wordpress.com would be amazing
Realize that I am a programmer.
I can learn more photoshop/sketch type stuff, but for now need to get a handle on the setup of the website to just write the code!
I really need your help. Thanks for your time
~Coty
I am having problems importing data what does collation mean?
The reason I ask is I keep getting an error importing data.. So I am looking at my wp-config file and the collation reads as follows.
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
So I go over to phpMyAdmin and the Server charset is UTF-8 Unicode (utf8) I don't know if this has any meaning but in the server connection collation box it reads utf8mb4_unicode_ci
.
Here's where I think the problem lies but I am a total newbie with mySQL. My main wordpress database has collation type latin1_swedish_ci
next to it - under collation. (I'm not sweedish)
When I click into the database they all have utf8 charsets different ones some utf8mb4_unicode_ci
and some utf8_general_ci
- does this mean the database is set up incorrectly?
Could this be the cause of my import problems and how do I fix it.
I have created a function that allows users to mark a custom post type in wordpress as viewed. When they mark it, the post_id they have viewed is noted in wp_usermeta in the db.
Here is the code that marks the post as viewed:
function lesson_watched() {
$nonce = $_POST['nonce'];
if ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) )
die ( 'Busted!');
if(isset($_POST['lesson_watched']))
{
$user_id = get_current_user_id();
$post_id = $_POST['post_id'];
if(!hasAlreadyWatched($post_id, $user_id))
update_user_meta($user_id, 'has_watched_lesson', $post_id);
else if(hasAlreadyWatched($post_id, $user_id))
delete_user_meta($user_id, 'has_watched_lesson', $post_id);
}
exit;
}
function hasAlreadyWatched($post_id) {
$user_id = get_current_user_id();
if(get_user_meta($user_id, 'has_watched_lesson', $post_id)!='') {
return true;
} else {
return false;
}
}
I have created a function to check if a post is marked as viewed and returns true or false:
function is_lesson_watched() {
$member = MS_Plugin::$api->get_current_member();
// if user has membership AND has watched the video
if(hasAlreadyWatched($post_id) && $member->has_membership()) {
return true;
}
return false;
}
On the front end of my site, I have a loop that shows all posts from a custom post type. I am trying to add a span to all posts that are marked as viewed by using the following code:
<?php if(is_lesson_watched()) {
echo '<span class="fa fa-eye watched_lesson_stamp"></span>';
} ?>
Note: this code is placed within a loop. My issue is that this code seems to add the span to all listed posts in the post type - not the ones that are viewed.
I'm dealing with a client who has very strict requirements for their subscription model and I'm trying to bend Woocommerce to their specifications. I've had to do a fair bit of customization, and I'm running into some slightly vague documentation regarding renewal/resubscription in Woocommerce. I was hoping to get some input before I try to tear this apart and built more custom script.
The client wants to provide subscribers with a "grace period" of 30 days after their subscription expires. So it seems like the default behavior is that if a subscription is renewed, the sign up fee will not be charged, and also that if a subscription is expired, after any window of time they can resubscribe and reactivate that same subscription without paying the sign up fee.
I'm wondering if there is a way you can configure the subscriptions so that when they expire, after x days without the order being fulfilled, the subscription will be completely invalidated such that if the member re-subscribes they start from scratch and must pay the sign up fee again.
Can I accomplish this with the Hold Stock option? Is this a possibility without writing some custom code? Thanks in advance!
I am working with Wordpress via Visual Composer and a post grid of results from The Events Calendar. I have the query working as long as I only want to pull from one events category but I need to pull from multiple categories.
I have tried all of the tricks using OR operators and cannot get this to work. The code I have that works to pull from one category:
post_type=tribe_events&post_status=publish&_EventStartDate=>$today&orderby=_EventStartDate&order=asc&tribe_events_cat=entertainment
I need to pull results from Entertainment and Concerts.
Is it possible to set in the post a multiple relationships between multiple taxonomies?
For example, I create three taxonomies: aspect_ratio, diameter, width
Now I want to post a new product post(for example post name "GoodYeap Tire ax123") with two combination of these three taxonomies.
{aspect_ratio : "80", diameter : "13", width : "200"},
{aspect_ratio : "90", diameter : "14", width : "175"}
Of course I know that I can make one hierarchy taxonomy, but i don't want make many terms repeats.
I'm using Buddypress and getting a 404 on admin-ajax.php when trying to log in on a front-end form. I followed this tutorial to make the ajax forms: http://ift.tt/JnfhqG
If you try to log in nothing happens, but if you refresh the page you are actually logged in. You should be redirected to the homepage once logged in. The same thing happens on the sign up form. An ajax request is sent when a username is inputted to check if it's in use or not.
This used to work perfectly and then suddenly stopped, on either a wp or bp update. I can't find any info on this particular problem anywhere.
If I deactivate Buddypress, this problem goes away.
Login page: http://ift.tt/291aXdt Try any old username and password to get the 404 in console.
My login function looks like this
function ajax_login_init(){
wp_register_script('ajax-login-script', get_template_directory_uri() . '/scripts/ajax-login-script.js', array('jquery') );
wp_enqueue_script('ajax-login-script');
wp_localize_script( 'ajax-login-script', 'ajax_login_object', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'redirecturl' => home_url(),
'loadingmessage' => __('Sending user info, please wait...')
));
// Enable the user with no privileges to run ajax_login() in AJAX
add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' ); }
add_action('init', 'ajax_login_init') ;
I've tried using an abosulte link in place of admin_url( 'admin-ajax.php' ), and even copying the admin-ajax file elsewhere, and nothing is working. This problem occurs both on my localhost and the live site.
On our website, the Facebook and Twitter icons are stacked on top of each other. We're using wordpress for the site, and the CSS makes sense, but it isn't updating / doesn't work.
What am I doing wrong?
Heres the CSS:
#fb {
z-index: 999999;
bottom: 70px;
right: 220px;
}
#twitter {
z-index: 999999;
bottom: 70px;
right: 220px;
}
I am making a site for Wordpress and I have a sidebar that is longer than the content (post previews with thumbnails) returned. I am using flexbox to build the layout and when the sidebar is longer than the previews, there is a huge gap in between. I have quickly thrown together a codepen. Sorry if it is a bit messy.
//page wrapper for sidebar
.flexPageWrapper {
display:flex;
/* Centering the page */
max-width:1500px;
margin:0 auto;
}
//search results flexbox container
.searchContentWrap {
flex-grow: 1;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
margin-right: 1em;
flex-direction: row;
}
I want each row to not have a gap in between as it would if the sidebar was nice and short.
I am looking for a way to run a global search query across all or multiple post types using WP REST API.
I am able to search posts using:
http://ift.tt/2913U4C
In turn I am able to search pages using:
http://ift.tt/298xPvC
How do I search across both posts and pages? I was able to do this in WP REST API V1 by specifying multiple type[]
variables in the query?
I want to create a Wordpress plugin, but after replacing a few words with Notepad, the whole plugin won't show up anymore. I have tried checking all lines, reverting it back to what it was, nothing. It's dead! I hope someone can help me out, this really frustrates me.
<?php
function em_settings_page() {
global $em_options;
$selected_page = ! empty( $em_options['page'] ) ? $em_options['page'] : 0;
?>
<div class="wrap">
<div id="upb-wrap" class="upb-help">
<h1><?php
$maintenance = __('Maintenance');
$settings = __('Settings');
echo "$maintenance $settings";
?></h1>
<?php
if ( ! isset( $_REQUEST['updated'] ) )
$_REQUEST['updated'] = false;
?>
<?php if ( false !== $_REQUEST['updated'] ) : ?>
<div class="updated fade"><p><?php _e( 'Options saved' ); ?></p></div>
<?php endif; ?>
<form method="post" action="options.php">
<table class="form-table">
<?php settings_fields( 'em_settings_group' ); ?>
<tr>
<td><strong><?php echo __('Enabled'); ?></strong></td>
<td><input id="em_settings[enable]" class="js_enabled" name="em_settings[enable]" type="checkbox" value="1" <?php checked( true, isset( $em_options['enable'] ) ); ?>/></td>
</tr>
<tr>
<td><strong><?php echo __('Page'); ?></strong></td>
<td>
<?php $pages = get_pages(); ?>
<select id="em_settings[page]" name="em_settings[page]">
<?php foreach($pages as $page) { ?>
<option value="<?php echo esc_attr( $page->ID ); ?>" <?php if( $selected_page == $page->ID ) { echo 'selected="selected"'; } ?>><?php echo $page->post_title; ?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="button-primary" value="<?php _e( 'Save' ); ?>" /></td>
</tr>
</table>
</form>
</div>
</div>
<?php
}
function em_register_settings() {
register_setting( 'em_settings_group', 'em_settings' );
}
add_action( 'admin_init', 'em_register_settings' );
function em_settings_menu() {
add_submenu_page('options-general.php', __('Maintenance'), __('Maintenance'),'manage_options', 'maintenance', 'em_settings_page');
}
add_action( 'admin_menu', 'em_settings_menu' );
function maintenance_stylesheet() {
?>
<style type="text/css">
#wpadminbar #wp-admin-bar-maintenance {background-color:#c30000;}
#wpadminbar #wp-admin-bar-maintenance a {font-weight:bold;}
</style>
<?php
}
add_action('admin_head', 'maintenance_stylesheet');
if($em_options['enable'] == "1") {
function create_maintenance_menu() {
global $wp_admin_bar;
$menu_id = 'maintenance';
$wp_admin_bar->add_menu(array(
'id' => $menu_id,
'title' => __('Maintenance'),
'href' => 'options-general.php?page=maintenance'
));
}
add_action('admin_bar_menu', 'create_maintenance_menu', 2000);
}
?>
So the issue is that the whole settings page isn't showing up anymore in the left sidebar of the admin backend.
We have a site where we publish viral and trending content. The website is currently built in HTML. We work with social media publishers to publish this content on their social media pages, i.e. FB, Twitter, etc.
Since our primary source of revenue is through advertising, when we provide the URLs to our publishers, we append UTM parameters in the URLs to allow individual tracking of each publisher's traffic being sent to our site. For example:
Publisher 1: http://ift.tt/296wgza
Publisher 2: http://ift.tt/292cEJP
Then in our 3rd party system we can see:
UTM Source: Pub1 Pageviews: ####### Earnings: $$$$$$
UTM Source: Pub2 Pageviews: ####### Earnings: $$$$$$
We have implemented some javascript code on our pages that keeps all (UTM) parameters after the ? in the URL from page to page and all links on the pages. This allows us to associate the user's activity as they navigate through the site to that particular publisher. This is also used for earnings allocation/tracking.
Since we have decided to move to Wordpress for our content management, I have been thoroughly searching the web for a solution to replicate the above for Wordpress and have not been successful.
To provide some context over what I've found and tried so far:
Having said the above, I'm open if the method we currently use on our HTML site is not the same way we would/should use in Wordpress. As long as it meets these requirements:
Hopefully there's a solution I've clearly missed because I'm all out of ideas at the moment.
Good evening!
This is more of a general question of how to approach a problem, rather than asking for specific code (but of course, anything is welcome that could help out!).
I'm developing a site where the intro is what volvocars.com is: a portal where you can select a country and in most cases it's the native tongue of that country, but it usually fallbacks to English if there's no language support.
I'm aiming to build something similar, where WPML is thought of to be the base, handling the languages (right now, around 6-7). There are some requirements though:
Is there an easy way to do this? Should I go with rewriting the permalinks through WordPress? Or should I change something in .htaccess
?
class ACF_populate_language {
/**
* Initialize the class
*/
public function __construct() {
// Make an array of the field ID's for the different parts of the world (defined in the ACF settings)
$fields = array(
'5756c03647974', // Asia & The Pacific
'5756c36c54753', // Europe
'5756c38754757', // North & South America
'5756c3db5475b', // Middle East & Africa
);
foreach ($fields as $f) {
add_filter( 'acf/load_field/key=field_' . $f, array( $this, 'acf_populate_language' ) );
}
}
/**
* Populate the input checkboxes in "Settings for countries" with languages from WPML
*
* @since 1.0.0
*/
public function acf_populate_language( $field ) {
$field['choices'] = array();
// Get all the WPML languages, ordered by ID
$languages = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' );
if ( !empty( $languages ) ) {
foreach( $languages as $l ) {
$field['choices'][ $l['language_code'] ] = $l['translated_name'];
}
}
return $field;
}
}
I'm creating a project where I need to use Gravity Forms multi-page forms. This form is to create a custom membership with different types of aircrafts. On the first page on the form is where I select the aircraft and the next page is to select the number of hours, the next are perks, add-ons, and finally the last page is a summary.
I created a Custom Post Type for the aircrafts and then added ACF option pages in this custom post type for Hours, Perks, and Add-ons.
I am using the following filters to get the Categories of the aircrafts, aircrafts themselves, hours, perks and add-ons to populate checkbox fields on Gravity Forms.
add_filter( 'gform_pre_render_6', 'your_function_here' );
add_filter( 'gform_pre_validation_6', 'your_function_here' );
add_filter( 'gform_pre_submission_filter_6', 'your_function_here' );
add_filter( 'gform_admin_pre_render_6', 'your_function_here' );
Each type (Category, aircraft, perks, hours and add-ons) has its own function to populate into the gravity form field checkboxes.
Each aircraft has its own custom fields for range, luggage capacity, etc... I need to display these posts and their custom fields for each Checkbox. How i'm currently doing this is with Underscore JS to filter through what categories I select and display those aircrafts.
I can not get this information then to display so I use jQuery to move these elements in their own <li class="gfield">
element and place it above the checkboxes. Please tell me if this is the best way to do this.
ISSUE #2
Now my next issue is when I navigate to the next form page, the information that I have displaying above their respective checkboxes is also being moved by jQuery. Now If I select say a specific number of Hours and then decide I want to change my aircraft, I hit the "Previous Step" button and then my aircrafts don't display as well as the category.
Now if I try to navigate back to the hours, the hours that I have displaying above their respective checkboxes do not display. It seems they all disappear or break?
I have tried using gform_post_render
and gform_page_loaded
and nothing seems to be help to display these items back to where they were supposed to go.
I've tried looking all over the place for help and I have no idea what to do.
I need to change the editor of bbpress plugin to tinymce, So i add this code in my function.php
file and not change any thing.
And still show me nicedit editor.
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['teeny'] = false;
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
What can i do now ?
Wordpress gives you the option to change your permalink structure to basically anything you want. While I am aware of how to do this by editing the .htaccess
or httpd.conf
files, I don't understand how Wordpress does it.
How can I funnel all URLs through a single PHP file without changing the .htaccess or server configuration?
I've been working on a contact email form on my own localhost in wordpress before I move it onto the actual website. This is how i've been sending the mail on my localhost:
require_once(ABSPATH . WPINC . '/class-phpmailer.php');
$pmail = new PHPMailer();
$pmail->From = strip_tags($email);
$pmail->FromName = $fullname;
$pmail->Subject = $subject;
$pmail->IsHTML(true);
$pmail->AddAddress('example@gmail.com', 'Simon');
$pmail->AddAttachment($filepath,$filename);
$pmail->Body = $message;
if($pmail->Send()) my_contact_form_generate_response("success", $message_sent);
else my_contact_form_generate_response("error", $message_unsent);
echo $pmail->Errorinfo;
I've tried adding this SMTP code but im not sure if I did it correctly or if thats how you do it.
Adding this:
$pmail->Host = "smtp.gmail.com"; // SMTP server
$pmail->Port = 465;
$pmail->SMTPAuth = true;
$pmail->Username = "my@gmail.com";
$pmail->Password = "mypass";
$pmail->isSMTP();
$pmail->SMTPSecure = 'ssl';
The error message i've been getting is "Could not instantiate mail function".
When I added the SMTP my error was "SMTP connect() failed."
I've included the Modernizr Touch Events detection to my project (only left the rest out to keep it light as possible).
I use it to set different Google Maps JS options as following:
<script>
function initMap() {
var myLatLng = {lat: 52.022322, lng: 4.209055};
if( Modernizr.touchevents ) {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
disableDefaultUI: false,
center: myLatLng,
scrollwheel: true,
draggable: false,
});
} else {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
disableDefaultUI: false,
center: myLatLng,
scrollwheel: false,
draggable: true,
});
}
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Duijnisveld Kasconstructies',
});
}
</script>
I've included this script in my page-contact.php file which displays the contact page on my Wordpress project.
Whenever I view the page I see no map and note the following error in my console: (index):235 Uncaught ReferenceError: Modernizr is not defined
What am I missing here?
Thanks guys!
Wordpress Multisite Sub-directory Setup Problems
Hi everyone! I have a problem with a loading styles, scripts and images files for sites in a multisite network.
They all are loaded by incorrect urls as you can see in attachments. I've setted up my network by wordpress instructions, and there are how my .htaccess and wp-config look like:
.htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
wp-config.php
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'wp-testing6');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
Wordpress loads file, for example, using this url
http:// wp-testing6/test1/wp-content/themes/twentysixteen/style.css
but this style stores here
http:// wp-testing6/wp-content/themes/twentysixteen/style.css
So, if you know how to fix that problem let me know please!
I have plesk hosting on godaddy. i try to install wordpress on it but it still display 0 % complete till 1 hours.
Please help me out this..
I've got a version 4.6.0 MySql database that I need to adjust/convert to 4.3.8.
Migrating from hosts. No more access to existing database, only the exported one I have now. Long story.
Is this possible?
I want to test my audio file using a training model i.e. using MFCC features which have already been stored in a text file , now I want to read the features from my text file and test the input and the classifier used is GMM and I am using python. so help me how can I do this?
I have a post type that uses a custom meta field called start_date
. I want to be able to get all posts that have a start_date
between date1 and date2. I have been able to figure out how to get posts before or after a date using wp_query by declaring the query type as "DATE".
$queryargs = array('meta_key' => 'start_date', 'meta_value' => "2016-06-01", 'meta_compare' => '>', 'type' => 'DATE','posts_per_page' => $instance['pastlimit']);
This pulls posts with a start_date after the 1st, but i also want to make it limit dates that dont occur after the 1st of the next month. I cant add the same args again as they dont specify the difference in the constraint. Is it possible to alter the query i have to get posts between a date range.
my host has blocked proc_open and popen functions for security reasons, they said they cannot do anything to let me use them, so the question is: what can I use to replace those functions? Basically, this PHP plugin, that I have allows me to echo what python is printing, with a shortcode. This is the code:
<?php # -*- coding: utf-8 -*-
/* Plugin Name: day7 */
header('Content-Type: text/html; charset=cp1252');
add_shortcode( 'day7', 'execute_python_with_argv' );
function execute_python_with_argv(){
ob_start();
$description = array (
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
);
$application_system = "python ";
$application_path .= plugin_dir_path( __FILE__ );
$application_name .= "day7.py";
$separator = " ";
$application = $application_system.$application_path.$application_name.$separator;
$pipes = array();
$proc = proc_open ( $application , $description , $pipes );
if (is_resource ( $proc ))
{
echo stream_get_contents ($pipes [1] ); //Reading stdout buffer
}
$output = ob_get_clean();
return $output;
}
Any help would be appreciated, thanks for reading.
Can someone help me to remove margins I get at the bottom of the http://ift.tt/29l4344 - I could not find exact CSS code for this. Please help. thank you. My code sample - .top-iframe { height:100%;
}
I'm developing a WordPress site that uses the Responsive Nav jquery plugin for the mobile menu. I'm also using a jquery script to create a sticky nav menu.
I'm building off the Bones starter theme.
The issue is when the dropdown menu is open on mobile, it blocks the whole screen because of the sticky nav script.
I'm wondering if there's a way to adjust this so that the menu is only sticky on mobile when it's closed?
Here's a link to the test site: http://ift.tt/291skxH
Here's my script for the sticky nav. This was added to my scripts.js file that loads in the theme footer.
$(document).ready(function() {
var stickyNavTop = $('.nav').offset().top;
var stickyNav = function(){
var scrollTop = $(window).scrollTop();
if (scrollTop > stickyNavTop) {
$('ul#menu-main-navigation').addClass('sticky');
} else {
$('ul#menu-main-navigation').removeClass('sticky');
}
};
stickyNav();
$(window).scroll(function() {
stickyNav();
});
});
I put the responsive nav script in my library/js folder, then enqueued the script in my bones.php file. Here's how I'm calling the responsive-nav plugin in my footer.php file:
<script>
var nav = responsiveNav(".nav-collapse", { // Selector
animate: true, // Boolean: Use CSS3 transitions, true or false
transition: 284, // Integer: Speed of the transition, in milliseconds
label: "Menu", // String: Label for the navigation toggle
insert: "before", // String: Insert the toggle before or after the navigation
customToggle: "", // Selector: Specify the ID of a custom toggle
closeOnNavClick: false, // Boolean: Close the navigation when one of the links are clicked
openPos: "relative", // String: Position of the opened nav, relative or static
navClass: "nav-collapse", // String: Default CSS class. If changed, you need to edit the CSS too!
navActiveClass: "js-nav-active", // String: Class that is added to element when nav is active
jsClass: "js", // String: 'JS enabled' class which is added to element
init: function(){}, // Function: Init callback
open: function(){}, // Function: Open callback
close: function(){} // Function: Close callback
});
</script>
How can I control the visibility of menu items in wordpress?
I can control status and visibility of a page:
Status: - published - draft - pending review
Visibility: - public - password protected - private
I need a snippet to connect this properties with the visibility of the associated menu item.
I have a small bit of code which calculates the cart total (excluding taxes) and outputs a Free Shipping upsell, if the cart total is less than $50.
// Shipping Upsell
/**
* Checks the cart for the Total excluding taxes
* @param $total_required
* @return bool
*/
function qualifies_basedon_cart_total( $total_required ) {
/*
* We only want to run this on the cart or checkout page
* If the cart subtotal is less than $total_required for free shipping, return true
*/
if( is_cart() || is_checkout () ) {
if( WC()->cart->subtotal_ex_tax < $total_required ) {
return true;
}
}
// do nothing
return false;
}
function shipup(){
// tests if total is below $50 and displays upsell if query returns ture
if( qualifies_basedon_cart_total( 50 ) ) {
echo "<div class =\"shipup\"><h3>Free Shipping</h3>\n<p>Get free shipping on all orders over $50!</p></div>";
}
}
add_action ('woocommerce_cart_collaterals','shipup', 1);
The code above works great on the initial page load, but after changing the quantity on the cart page and selecting 'Update Cart' the code I have above (in functions.php) does not adjust itself based on the new cart total.
I believe the update cart button uses AJAX and my code is not able to tap into that. How can AJAXIFY my code so that it works based on the dynamic cart total?
I have a somewhat strange issue with WordPress today. This behaviour has only begun in the last week or so as far as I can ascertain.
Any page with the slug "downloads" links to it's parent page instead of to it's own page.
I have tried the following:
But none of the above fix the issue. The weird thing is that this behaviour is only happening for pages with the slug "downloads". For all other slugs it is fine.
For example there are multiple instances of the slug "get-involved" with different parents and all work fine. But when the same is done with "downloads" the links redirect to their parent. Is anyone else experiencing this issue?
I have also verified in fiddler that the pages are not redirecting, they are actually linking to the parent page with a response code of 200, there is no 301 or 302 thrown.
I cannot seem to find a way of being able to use the row number in the PHP template. When you go onto the pages page in the admin panel, each repeater item has an associated row number starting from 1. I would like to call this in the template?
I have a quick question which would really help me out, i'm sure it must be simple -- if its possible.
I am developing a wordpress website and using Chrome Inspects to edit the CSS, which i'm fine with. However, when I want edit the html code, I cant find the name of file i am editing on elements. Is there a way to find out the file name?
Hope that makes sense,
All the best,
Joe
When setting 'hierarchical' => true to a custom post type and assigning a parent to a page with this custom post type throws 404. It is posible to make this work?
Expected result: http://ift.tt/290PtSG
This works with Wordpress normal pages, but not with custom post types (404 not found).
Thanks in advance!
I wrote my own Plugin and i want to access my plugin options in a Config class. Here is an example of my code.
class Config {
private $var = get_option('option');
public function getMyOption () {
return $this->var;
}
}
But i get this error :
parse error: syntax error, unexpected '(', expecting ',' or ';' in
The Problem here ist how can i use the option values in a class? Could somebody explain me, how i can access the get_option value in a class?
I am trying to change the price of certain items if the customer is a returning visitor. I'm running a redirect to http://ift.tt/2957SfO through Adobe Target to sense if the customer is returning.
I want to change the price of an item only for the welcome back user's session, not actually change the price in the DB.
So normally Product ID #43 would be 1500.00, but a returning visitor will see a "special" price of 1,450.00.
Is this possible within WooCommerce?
Facing a weird issue. The filter isn't working at all. I want the user to redirect to the checkout page after registration. I tried putting the cart url instead of checkout and that too doesn't work. My other redirect with the woocommerce_add_to_cart_redirect
filter works fine.
function custom_registration_redirect() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}
add_filter( 'woocommerce_registration_redirect', 'custom_registration_redirect' );
I tried searching for any plugin which would be overriding this but can't seem to find anything there.
After registration it's going to the My Account page with a _wc_user_reg
query string suffixed: /my-account/?_wc_user_reg=true
.
It's just not listening to this filter and always going here.
Any idea what is causing this problem?
Thanks.
We use a lot of plugins and unfortunately can't remove more of them. Our backend is slow.
Wordpress is built to load each plugin in the wp-admin backend. So event if you are on the overview on the pages, where no plugin would be needed, woocommerce, contact form 7 etc. will be loaded. They put their CSS in the page but also do PHP stuff and slow everything down.
Is there already a plugin or a hand crafted solution to select which plugins should be deactivated/activated on with wp-admin pages?
The plugins have to be loaded to build the menu - but maybe the menu could be cached. And than only activate heavy plugins on certain pages or something?
Do you know of existing solutions to lower the time needed to build the backend. Are there any caching options?
I'm trying to optimize images on my WordPress site with Yoast, and for some reason I get this with every image. screenshot
Even though this is just an image and isn't supposed to have text .How do I get rid of the error?
I'm trying to hook a function to the order deletion (when permanently delete is clicked from admin page) but for some reason the function isn't called. My code looks something like
add_action('woocommerce_before_delete_order_item', function($id) {
$order = new WC_Order($id);
//do some stuff with order meta data
}, 10, 1);
I tried to throw and exception inside the function but no error occurred. Can somebody help?
I would like to show the value of my field created with Advanced Custom Fields plugin, also in the cart and checkout page of WooCommerce. I'm using the code below in the functions.php
page of my theme, which displays only in the single page of the product:
add_action( 'woocommerce_before_add_to_cart_button', 'add_custom_field', 0 );
function add_custom_field() {
global $post;
echo "<div class='produto-informacoes-complementares'>";
echo get_field( 'info_complementar', $product_id, true );
echo "</div>";
return true;
}
Thank you all in advanced for all the help given and excuse my english.
I have created this wordpress module for a shortcode and was wondering if there is any better way of doing it, to make it more light weight.
below is my code
<?php
add_shortcode( 'logo_section', function($atts) {
$output = '';
$atts = shortcode_atts( array(
// title
'section-title' => '',
'section-title-text' => '',
'image-source' => '',
'image-width' => '',
'image-height' => '',
'image-alt' => '',
// logos
'logo-1' => '','logo-1-image-source' => '','logo-1-alt' => '',
'logo-2' => '','logo-2-image-source' => '','logo-2-alt' => '',
'logo-3' => '','logo-3-image-source' => '','logo-3-alt' => '',
'logo-4' => '','logo-4-image-source' => '','logo-4-alt' => '',
'logo-5' => '','logo-5-image-source' => '','logo-5-alt' => '',
'logo-6' => '','logo-6-image-source' => '','logo-6-alt' => '',
'logo-7' => '','logo-1-image-source' => '','logo-7-alt' => '',
'logo-8' => '','logo-2-image-source' => '','logo-8-alt' => '',
'logo-9' => '','logo-3-image-source' => '','logo-9-alt' => '',
'logo-10' => '','logo-4-image-source' => '','logo-10-alt' => '',
'logo-11' => '','logo-5-image-source' => '','logo-11-alt' => '',
'logo-12' => '','logo-6-image-source' => '','logo-12-alt' => '',
), $atts );
$output .= '<div class="logo-section clearfix">';
$output .= '<div class="logo-section--inner clearfix">';
if ($atts['section-title'] == 'true') {
$output .= '<h2 class="heading--small heading--bold heading--uppercase heading--sans-serif heading--center">'. $atts['section-title-text'] .'</h2>';
} else {
$output .= '';
}
// first row
$output .= '<div class="logo-section--row clearfix">';
if ($atts['logo-1'] == 'true') {
$output .= '<img src="' . $atts['logo-1-image-source'] . '" alt="' . $atts['logo-1-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-2'] == 'true') {
$output .= '<img src="' . $atts['logo-2-image-source'] . '" alt="' . $atts['logo-2-alt'] . '" />';
}
if ($atts['logo-3'] == 'true') {
$output .= '<img src="' . $atts['logo-3-image-source'] . '" alt="' . $atts['logo-3-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-4'] == 'true') {
$output .= '<img src="' . $atts['logo-4-image-source'] . '" alt="' . $atts['logo-4-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-5'] == 'true') {
$output .= '<img src="' . $atts['logo-5-image-source'] . '" alt="' . $atts['logo-5-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-6'] == 'true') {
$output .= '<img src="' . $atts['logo-6-image-source'] . '" alt="' . $atts['logo-6-alt'] . '" />';
} else {
$output .= '';
}
$output .= '</div>';
// second row
$output .= '<div class="logo-section--row clearfix">';
if ($atts['logo-7'] == 'true') {
$output .= '<img src="' . $atts['logo-7-image-source'] . '" alt="' . $atts['logo-7-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-8'] == 'true') {
$output .= '<img src="' . $atts['logo-8-image-source'] . '" alt="' . $atts['logo-8-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-9'] == 'true') {
$output .= '<img src="' . $atts['logo-9-image-source'] . '" alt="' . $atts['logo-9-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-10'] == 'true') {
$output .= '<img src="' . $atts['logo-10-image-source'] . '" alt="' . $atts['logo-10-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-11'] == 'true') {
$output .= '<img src="' . $atts['logo-11-image-source'] . '" alt="' . $atts['logo-11-alt'] . '" />';
} else {
$output .= '';
}
if ($atts['logo-12'] == 'true') {
$output .= '<img src="' . $atts['logo-12-image-source'] . '" alt="' . $atts['logo-12-alt'] . '" />';
} else {
$output .= '';
}
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
return $output;
});