samedi 30 avril 2016

How to add custom variable (for Yoast WordPress SEO plugin) - for custom taxonomy term?

To add custom variable (for Yoast WordPress SEO plugin) - for posts of custom post type I use in my functions.php this code, and it's work correctly:

function get_meta_for_title_of_metro() {
 return get_post_meta(get_the_ID(), 'title-of-metro', true);
}
function register_custom_extra_replacements() {
 wpseo_register_var_replacement( '%%title-of-metro%%', 'get_meta_for_title_of_metro', 'advanced', 'it is custom field' );
}
add_action('wpseo_register_extra_replacements', 'register_custom_extra_replacements');

*in this case I have:

  • custom field: title-of-metro

  • custom variable (for Yoast WordPress SEO plugin): %%title-of-metro%%

.....

In a case with custom taxonomy term I try to use analogycal code. *Instead get_post_meta(); I try to use get_term_meta(); - but this code work incorrectly (can't get value of custom field title-of-metro):

function get_meta_for_title_of_metro() {
 return get_term_meta(get_the_ID(), 'title-of-metro', true);
}
function register_custom_extra_replacements() {
 wpseo_register_var_replacement( '%%title-of-metro%%', 'get_meta_for_title_of_metro', 'advanced', 'it is custom field' );
}
add_action('wpseo_register_extra_replacements', 'register_custom_extra_replacements');

Question: How to change this code (in functions.php), to add custom variable (for Yoast WordPress SEO plugin) - for custom taxonomy term?



via Chebli Mohamed

Wordpress: Edit my content

So I'll need a plugin that will let me edit my website in a sales copy format.

I'm just a guy trying to find a way to edit the text, pics etc. Instabuilder 2.0 has seemed to work great for me before, but i need something else. Please Help!



via Chebli Mohamed

PHP Tracking Script - Error sending multiple products WooCommerce

I now have the below which is sending WooCommerce order details to a CRM...

However, when more than 1 item is in the basket and checked out, only the first item reaches the CRM. Any second, third items do not get sent.

I was hoping there's an obvious mistake that could easily be spotted by someone far more talented than I??

<?php
/**
 * Plugin Name: eCommerce Tracking
 * Plugin URI: 
 * Description: Send shopping data to CRM
 * Version: 1.0
 * Author: Fly
 * Author URI: 
 * License: GPL2
 */

add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {

// Lets grab the order
    $order = new WC_Order( $order_id );

    // Order ID
    $order_id = $order->get_order_number();

    // Order total
    $order_total = $order->get_total();

    // Order e-mail
    $order_email = $order->billing_email;

    // Order Billing First Name
    $order_fname = $order->billing_first_name;

    // Order Billing Last Name
    $order_lname = $order->billing_last_name;

    // Order Billing Address 1
    $order_bill1 = $order->billing_address_1;

    // Order Billing Address 2
    $order_bill2 = $order->billing_address_2;

    // Billing City
    $order_billcity = $order->billing_city;

    // Billing State
    $order_billstate = $order->billing_state;

    // Billing Postcode
    $order_billpostcode = $order->billing_postcode;

    // Billing Country
    $order_billcountry = $order->billing_country;

    // Billing Phone
    $order_billphone = $order->billing_phone;

    // Order Tax Cost
    $order_tax = $order->get_total_tax();

    // Order Shipping Cost
    $order_shippingcost = $order->order_shipping;

    // Order Currency
    $order_currency = $order->order_currency;

    // Product Category
    $order_category = $order->term_id;

    // Product Name
    $order_product = $order->item_id;

    // Product Quantity
    $order_quantity = $order->quantity;

    // Product SKU
    $order_sku = $order->sku;

    // Product Price
    $order_price = $order->price;


?>




    <!-- Start Tracking code -->
 <script type="text/javascript">
var _ss = _ss || [];
_ss.push(['_setDomain', 'http://ift.tt/1r5Beju']);
_ss.push(['_setAccount', 'KOI-XXXXXXXX']);
_ss.push(['_trackPageView']);
(function() {
    var ss = document.createElement('script');
    ss.type = 'text/javascript'; ss.async = true;

    ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'koi-3Q40EJNC5K.marketingautomation.services/client/ss.js?ver=1.1.1';
    var scr = document.getElementsByTagName('script')[0];
    scr.parentNode.insertBefore(ss, scr);
})();
</script>



<script type='text/javascript'>

    // SECOND EXAMPLE, USES CALLBACKS TO ENSURE ORDERING, AS OF Version 2.1 of the tracking (you will have to update your embeds)

    _ss.push(['_setTransaction', {
        'transactionID': '<?php echo $order_id; ?>',
        'storeName': 'Reco Surfaces',
        'total': '<?php echo $order_total; ?>',
        'tax': '<?php echo $order_tax; ?>',
        'shipping': '<?php echo $order_shippingcost; ?>',
        'city': '<?php echo htmlspecialchars($order_billcity); ?>', 
        'state': '<?php echo $order_billstate; ?>',
        'zipcode': '<?php echo $order_billpostcode; ?>',
        'country': 'UK',
        // the following params can be used for creating/updating
        // a contact in the context of the supplied transaction data.
        // if this data is omitted, the underlying contact/tracking data
        // associated with the visitors browser session is used automatically.
        'firstName' : '<?php echo $order_fname; ?>', // optional parameter
        'lastName' : '<?php echo $order_lname; ?>', // optional parameter
        'emailAddress' : '<?php echo $order_email ?>' // optional parameter
    }, function() {

<?php
$products = $order->get_items();


$count = 0;
 foreach( $products as $item_id => $item ) {
 $count++;
$product = $order->get_product_from_item( $item ); 
       $terms = get_the_terms( $item['product_id'], 'product_cat' );
$product_cat = '';
        foreach ($terms as $term) {
            $product_cat = $term->name;
            break;
        }
?>
        _ss.push(['_addTransactionItem', {
            'transactionID': '<?php echo $order_id; ?>',
            'itemCode': '<?php echo $product->get_sku(); ?>',
            'productName': '<?php echo $item['name']; ?>',
            'category': '<?php echo $product_cat; ?>',
            'price': '<?php echo $order->get_line_subtotal( $item ) / $item['qty']; ?>',
            'quantity': '<?php echo $item['qty']; ?>'
        }]);

<?php 
} 
?>

        _ss.push(['_completeTransaction', {
            'transactionID': '<?php echo $order_id; ?>'
        }]);

    }]);

</script>


    <!-- End Tracking code -->
<?php


}

?>



via Chebli Mohamed

Override standart calendar on Wordpress? Change link by click

As we know, we have standart calendar on WP and it's working like that: when we adding some post or news there are appear links to the page with all post by the date we choose at calendar.

For example, if we click on May 30 2016, we will redirect to
http://ift.tt/1QHdK9A

how can I override this function and I need to when you click on any date you will go to your certain link, for example:
**

link.com/api/{date}   
http://ift.tt/1rptQzZ  
http://ift.tt/1QHdI1i

**



via Chebli Mohamed

Wordpress: Visual Composer stuck on loading

Today I have installed Klaus Theme 1.5.2.Everything goes good but, then I tried to edit a Page and add Visual Composer elements the loading bar keeps loading. I have installed this theme with WPBackery on several servers and WP installments but same error.The plugin version is 1.5.2 and it can't be changed. Please Help!



via Chebli Mohamed

vendredi 29 avril 2016

How to test update routine for WordPress plugin works perfectly?

I'm writing update routine for plugin which is currently not upload on wordpress.org . the reason to write update routine is that few year back plugin with same name was uploaded on wordpress.org and i get old plugin svn credential and the member from plugins review team to write the update routine . My question how i check is my update routine is working perfect ? As there is no way i find to update the old plugin with my new plugin



via Chebli Mohamed

My changes in javascript file not reflecting in my plugin

I made change in Javascript file. Tried disabling plugin/re-activating/deleting javascript file and reuploading but nothing seems to upload the page as per my new javascript code.

Finally I went into view source and noticed the script src is set to "wp-content/plugins/my-plugin/js/my-plugin.js?ver=4.3.1"

If I type in this URL in the browser I get my old code back. However if I remove the query string at the end ?ver=4.3.1 it loads my new file code.

I am not sure who added ver=4.3.1. I don't have it in my plugin code. Could anybody please let me know how do I remove this and request my latest javascript code? It's been now more than a hour I am unable to fix this issue.

Many thanks!



via Chebli Mohamed

PHP String in Array returns only first charachter

I have a php function to display a list of revslider's sliders (wp plugin), the string returns only the first letter of the sliders' names here is my code :

function jobboard_revslider(){

    if (class_exists('RevSlider')) {
        $theslider     = new RevSlider();
        $arrSliders = $theslider->getArrSliders();
        $arrA     = array();
        $arrT     = array();
        foreach($arrSliders as $slider){
            $arrA[]     = $slider->getAlias();
            $arrT[]    = $slider->getTitle();
        }
        if($arrA && $arrT){
            $result = array_combine($arrA, $arrT);
        }
        else
        {
            $result = false;
        }
        return $result;
    }

}

I tried all I know and other answers around here but no hope. I would really appreciate a push ! Thanks



via Chebli Mohamed

WooCommerce Custom Ecommerce Tracking - almost there ...

Using an excellent resource cited below and helpful comments I've build out a Wordpress plugin (as per code) to send WooCommerce transaction data to a custom CRM. From the thank you page.

I've got stuck however. I can send the transaction value, tax and shipping details but I can't seem to call, or send; a) Product Name b) Product Category c) Product ID d) Details of product splits between more than one product

Any thoughts, links or advice much appreciated. New to this and trying to battle through.

<?php
/**
* Plugin Name: eCommerce Tracking
* Plugin URI: 
* Description: Send shopping data to CRM
* Version: 1.0
* Author: fly
* Author URI: 
* License: GPL2
*/

add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {



// Lets grab the order
$order = new WC_Order( $order_id );

// Order ID
$order_id = $order->get_order_number();

// Order total
$order_total = $order->get_total();

// Order e-mail
$order_email = $order->billing_email;

// Order Billing First Name
$order_fname = $order->billing_first_name;

// Order Billing Last Name
$order_lname = $order->billing_last_name;

// Order Billing Address 1
$order_bill1 = $order->billing_address_1;

// Order Billing Address 2
$order_bill2 = $order->billing_address_2;

// Billing City
$order_billcity = $order->billing_city;

// Billing State
$order_billstate = $order->billing_state;

// Billing Postcode
$order_billpostcode = $order->billing_postcode;

// Billing Country
$order_billcountry = $order->billing_country;

// Billing Phone
$order_billphone = $order->billing_phone;

// Order Tax Cost
$order_tax = $order->order_tax;

// Order Shipping Cost
$order_shippingcost = $order->order_shipping;

// Order Currency
$order_currency = $order->order_currency;

// Product Category
$order_category = $order->term_id;

// Product Name
$order_product = $order->item_id;

// Product Quantity
$order_quantity = $order->quantity;

// Product SKU
$order_sku = $order->sku;

// Product Price
$order_price = $order->price;


?>



<!-- Start Tracking code -->
<script type="text/javascript">
var _ss = _ss || [];
_ss.push(['_setDomain', 'xxxxxxxx']);
_ss.push(['_setAccount', 'xxxxxxx']);
_ss.push(['_trackPageView']);
(function() {
var ss = document.createElement('script');
ss.type = 'text/javascript'; ss.async = true;

ss.src = ('https:' == document.location.protocol ? 'https://' :     
'http://') + 'koi-3Q40EJNC5K.marketingautomation.services/client/ss.js?  
ver=1.1.1';
var scr = document.getElementsByTagName('script')[0];
scr.parentNode.insertBefore(ss, scr);
})();
</script>



<script type='text/javascript'>

_ss.push(['_setTransaction', {
    'transactionID': '<?php echo $order_id; ?>',
    'storeName': 'Reco Surfaces',
    'total': '<?php echo $order_total; ?>',
    'tax': '<?php echo $order_tax; ?>',
    'shipping': '<?php echo $order_shippingcost; ?>',
    'city': '<?php echo $order_billcity; ?>',
    'state': '<?php echo $order_billstate; ?>',
    'zipcode': '<?php echo $order_billpostcode; ?>',
    'country': 'UK',
    'firstName' : '<?php echo $order_fname; ?>', 
    'lastName' : '<?php echo $order_lname; ?>', 
    'emailAddress' : '<?php echo $order_email ?>' 
}, function() {

    _ss.push(['_addTransactionItem', {
        'transactionID': '<?php echo $order_id; ?>',
        'itemCode': '<?php echo $order_sku; ?>',
        'productName': '<?php echo $order_product; ?>',
        'category': '<?php echo $order_category; ?>',
        'price': '<?php echo $order_price; ?>',
        'quantity': '<?php echo $order_quantity; ?>'
    }]);

    _ss.push(['_completeTransaction', {
        'transactionID': '<?php echo $order_id; ?>'
    }]);

}]);

</script>


 <!-- End Tracking code -->
 <?php
 }



via Chebli Mohamed

How to edit the meta tags in particular post for open graph image and title in wordpress

i want to edit the meta tags for particular post to my video site. To display open graph for social medias i have different images for that



via Chebli Mohamed

Woocommerce - add custom products to card from plugin

i stuck on trying to adding a customized product to the wordpress card.

I made a calculator form plugin for wordpress to calculate the cost for printing stickers.

Now i just want to be able to put the post data from my calculator form combined as a string into the the woocommerce shopping cart

So if someone filled up the calculator and is happy about the settings he/she made. the submitted form gets processed to a string with all important information $string = "StickerCount=".$_POST['sticker_count']."StickerWidth=".$_POST['sticker_width']."StickerHeight=".$_POST['sticker_height'];

and then this string should be added to the woocommerce shopping card so the user sees the string there and can proceed to checkout.

__ I already tried to make a general product called sticker and add some custom data to it. but it did not work. i used global $woocommerce; $woocommerce->cart->add_to_cart(20); // 20 is the product id and then i somehow wanted to alter meta data or something. __

Actually i just want to create a string from what i ve gotten from my plugins table and then check it out with woocommerce.

best wishes, James R.



via Chebli Mohamed

How safe is using .= operator on an uninitialized variable?

I'm using some premium plugins, and analyzing their code I found, that in some functions they use code like:

$output .= $some_str;

when that $output wasn't mentioned anywhere before.

How safe is this code? I tried to find any guidance in PHP Manual for this, but for what I see, they only define it for both $output and $some_str being previously set before.

Later this $output variable is used to echo HTML code.

Did you see any specifications regarding that? Maybe there is something I could do outside of those plugins to make this code safer? Some default value defined for all uninitialized variables?

Thank you!



via Chebli Mohamed

How do I access my wordpress users' linked in connections?

I have a wordpress site that users can register with. How do I access my users' linked in connections? I can have them register their linked in user details or log in via their linked in details if necessary or possible....

Any ideas welcome.



via Chebli Mohamed

Long Waiting Time on Website

I have been having an issue with a custom theme I have build for wordpress. The waiting time on the site is around 20sec+.

I tried the following without success:

  • All plugins disabled.
  • removed all scripts including wordpress ones from the theme.
  • switched to a different host...

Anyone knows what could be the issue? I know that waiting time in firebug means waiting for server but can't figure out the problem.

Long Waiting Time on Website



via Chebli Mohamed

Gettting thelast page of gravity multipage form

I 'm looking for a function allowing to calculate the number of page generated by multipage form in GravityForm

I know there is this function $current_page = rgpost( 'gform_source_page_number_' . $form['id'] ) ? rgpost( 'gform_source_page_number_' . $form['id'] ) : 1; but i would like a function to get the number of the last page too

because i need the number od the first and the last page. thanks a lot



via Chebli Mohamed

Toggle Contact Form fields with JavaScript

I want to toggle some fields depending on what the visitor chooses at this page http://ift.tt/1rF8gYS so I created a dropdown menu with the id puesto and the fields to toggle with the class condicional then I added this script

document.getElementById("puesto").onchange = CamposOcultos(document.getElementById("puesto").value);

function CamposOcultos(valor){
if (valor == "Modelo" or valor == "Promotor/a"){
for (var i=0;i<document.getElementsByClassName('condicional').length;i+=1){
  document.getElementsByClassName("condicional")[i].style.display="block";}
else{ 
for (var i=0;i<document.getElementsByClassName('condicional').length;i+=1){
  document.getElementsByClassName("condicional")[i].style.display="none";} }
}

But I get the following error when I try to load the function in the chrome console

Uncaught SyntaxError: Unexpected identifier(…)

Any idea how can I make it work ?

Thanks !

PS: I am using Contact Form 7 on WordPress



via Chebli Mohamed

Inserting wrong data in table wordpress

When I insert the serialize data in the postmeta table the data is modified while inserting like:

s:107:"a:4:{s:6:"page_1";s:5:"third";s:6:"page_2";s:5:"first";s:6:"page_3";s:6:"fourth";s:6:"page_4";s:5:"fifth";}";

but when I print this data before inserting it is displaying this that is right:

a:4:{s:6:"page_1";s:5:"third";s:6:"page_2";s:5:"first";s:6:"page_3";s:6:"fourth";s:6:"page_4";s:5:"fifth";}

while inserting it is automatically add s:107:" in front of data or "; in back of data.

Can any one please tell me why it is inserting like this.

Thanks in Advance



via Chebli Mohamed

WP-D3 (Text Mode) and Persistent Paragraph Tags

I've posted this question in the Wordpress.org forum, but in case this isn't a WordPress-specific issue, I thought I'd post here as well.

I'm trying to insert an interactive Sankey chart, created with RCharts, into a WordPress page and am having some trouble figuring out why WP-D3 and my site are no longer on friendly terms: WordPress is inserting unwanted paragraph tags and breaks throughout my JavaScript.

Some extra context, if helpful: The WP-D3 has an interface for Visual Mode, but I create all of my posts in Text Mode (it makes editing in IE easier). I've used Text Mode in the past with success with D3 and NVD3. This situation has stumped me and I'm not sure if I've just overlooked something trivial or if there's something more complicated going on. I suspect the problem may have to do with the way WP is reading the call to the function in the first line, but am not sure.

Any solutions or suggestions that can point me in the right direction are very much appreciated!

Here's the page: http://ift.tt/1QEQNnq

Here's what I've attempted in terms of troubleshooting already:

  1. Checked the JavaScript for accuracy (it was created with RCharts and tested on my PC)

  2. Confirmed that the JavaScript files (d3.js and Sankey.js) are being called locally from the Media Library and that the element tags are listed between the [d3-link] tags.

  3. Confirmed that all of the JavaScript code, copied directly from the RCharts template, is inserted between the [d3-source] tags.

  4. Confirmed that the tag reference name matches the params element name (i.e., [d3-source canvas="sankey1"] )

  5. Confirmed that the Raw HTML plugin's "Disable automatic paragraphs" box is checked and that the wpautopop filter is removed from the content in the theme's functions.php file.

    remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );

In the interest of completeness, here is the full page content (it's merely the RCharts template with my test data inserted):

[d3-link]
<script src="http://ift.tt/1WuTJdk"></script>
<script src="http://ift.tt/26Ary1l"></script>
[/d3-link]  

[d3-source canvas="sankey1"]
//Attribution:
//Mike Bostock http://ift.tt/1azfduS
//Mike Bostock http://ift.tt/Lc0UCL
(function(){
var params = {
 "dom": "sankey1",
"width":    960,
"height":    500,
"data": {
 "source": [ "United States", "United States", "United States", "State", "State", "State", "person accused indicted or suspected of crime", "person accused indicted or suspected of crime", "alien person subject to a denaturalization proceeding or one whose citizenship is revoked", "attorney or person acting as such ", "water transportation stevedore", "person convicted of crime", "person convicted of crime", "person allegedly criminally insane or mentally incompetent to stand trial", "defendant", "defendant", "person subject to selective service including conscientious objector", "employee or job applicant including beneficiaries of", "employee or job applicant including beneficiaries of", "employer If employers relations with employees are governed by the nature of the employers", "employer If employers relations with employees are governed by the nature of the employers", "female employee or job applicant", "government contractor", "racial or ethnic minority employee or job applicant", "military personnel or dependent of including reservist", "owner landlord or claimant to ownership fee interest or possession of land as well as chattels", "indigent defendant", "prisoner inmate of penal institution", "prisoner inmate of penal institution", "prisoner inmate of penal institution", "person or organization protesting racial or ethnic segregation or discrimination", "person or organization protesting racial or ethnic segregation or discrimination", "railroad", "taxpayer or executor of taxpayers estate federal only", "union labor organization or official of", "union labor organization or official of", "witness or person under subpoena", "Department or Secretary of Labor", "National Labor Relations Board or regional office or officer", "National Labor Relations Board or regional office or officer" ],
"target": [ "  State", "  person accused indicted or suspected of crime", "  person convicted of crime", "  United States", "  person accused indicted or suspected of crime", "  person convicted of crime", "  United States", "  State", "  United States", "  United States", "  employee or job applicant including beneficiaries of", "  United States", "  State", "  State", "  United States", "  State", "  United States", "  employer If employers relations with employees are governed by the nature of the employers", "  railroad", "  employee or job applicant including beneficiaries of", "  union labor organization or official of", "  employer If employers relations with employees are governed by the nature of the employers", "  United States", "  employer If employers relations with employees are governed by the nature of the employers", "  United States", "  United States", "  State", "  governmental official or an official of an agency est under an interstate compact", "  United States", "  State", "  city town township village or borough government or governmental unit", "  State", "  employee or job applicant including beneficiaries of", "  United States", "  employer If employers relations with employees are governed by the nature of the employers", "  railroad", "  United States", "  employer If employers relations with employees are governed by the nature of the employers", "  employer If employers relations with employees are governed by the nature of the employers", "  union labor organization or official of" ],
"value": [ 12, 130, 31, 11, 151, 104, 232, 244, 20, 13, 22, 105, 218, 14, 33, 14, 22, 47, 51, 44, 30, 15, 12, 11, 20, 20, 17, 13, 12, 34, 15, 14, 17, 44, 39, 11, 34, 17, 68, 23 ]
},
"nodeWidth":     15,
"nodePadding":     10,
"layout":     32,
"id": "sankey1"
};

params.units ? units = " " + params.units : units = "";

//hard code these now but eventually make available
var formatNumber = d3.format("0,.0f"),    // zero decimal places
    format = function(d) { return formatNumber(d) + units; },
    color = d3.scale.category20();

if(params.labelFormat){
  formatNumber = d3.format(".2%");
}

var svg = d3.select('.sankey1').append("svg")
    .attr("width", params.width)
    .attr("height", params.height);

var sankey = d3.sankey()
    .nodeWidth(params.nodeWidth)
    .nodePadding(params.nodePadding)
    .layout(params.layout)
    .size([params.width,params.height]);

var path = sankey.link();

var data = params.data,
    links = [],
    nodes = [];

//get all source and target into nodes
//will reduce to unique in the next step
//also get links in object form
data.source.forEach(function (d, i) {
    nodes.push({ "name": data.source[i] });
    nodes.push({ "name": data.target[i] });
    links.push({ "source": data.source[i], "target": data.target[i], "value": +data.value[i] });
}); 

//now get nodes based on links data
//thanks Mike Bostock http://ift.tt/1DsrFiq
//this handy little function returns only the distinct / unique nodes
nodes = d3.keys(d3.nest()
                .key(function (d) { return d.name; })
                .map(nodes));

//it appears d3 with force layout wants a numeric source and target
//so loop through each link replacing the text with its index from node
links.forEach(function (d, i) {
    links[i].source = nodes.indexOf(links[i].source);
    links[i].target = nodes.indexOf(links[i].target);
});

//now loop through each nodes to make nodes an array of objects rather than an array of strings
nodes.forEach(function (d, i) {
    nodes[i] = { "name": d };
});

sankey
  .nodes(nodes)
  .links(links)
  .layout(params.layout);

var link = svg.append("g").selectAll(".link")
  .data(links)
.enter().append("path")
  .attr("class", "link")
  .attr("d", path)
  .style("stroke-width", function (d) { return Math.max(1, d.dy); })
  .sort(function (a, b) { return b.dy - a.dy; });

link.append("title")
  .text(function (d) { return d.source.name + " → " + d.target.name + "\n" + format(d.value); });

var node = svg.append("g").selectAll(".node")
  .data(nodes)
.enter().append("g")
  .attr("class", "node")
  .attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; })
.call(d3.behavior.drag()
  .origin(function (d) { return d; })
  .on("dragstart", function () { this.parentNode.appendChild(this); })
  .on("drag", dragmove));

node.append("rect")
  .attr("height", function (d) { return d.dy; })
  .attr("width", sankey.nodeWidth())
  .style("fill", function (d) { return d.color = color(d.name.replace(/ .*/, "")); })
  .style("stroke", function (d) { return d3.rgb(d.color).darker(2); })
.append("title")
  .text(function (d) { return d.name + "\n" + format(d.value); });

node.append("text")
  .attr("x", -6)
  .attr("y", function (d) { return d.dy / 2; })
  .attr("dy", ".35em")
  .attr("text-anchor", "end")
  .attr("transform", null)
  .text(function (d) { return d.name; })
.filter(function (d) { return d.x < params.width / 2; })
  .attr("x", 6 + sankey.nodeWidth())
  .attr("text-anchor", "start");

// the function for moving the nodes
  function dragmove(d) {
    d3.select(this).attr("transform",
        "translate(" + (
                   d.x = Math.max(0, Math.min(params.width - d.dx, d3.event.x))
                ) + "," + (
                   d.y = Math.max(0, Math.min(params.height - d.dy, d3.event.y))
                ) + ")");
        sankey.relayout();
        link.attr("d", path);
  }

})();
[/d3-source]



via Chebli Mohamed

Create Custom user Survey after user registers to wordpress website plugin?

I am looking for the plugin which allows us to create surveys. i want to keep one registration form from where user can register itself. after registration user should be allowed to create surveys from my site. can anyone tell me which plugin should i use. Thank You



via Chebli Mohamed

WooCommerce Shop page : Customize sorting dropdown to product categories dropdown

I would like to modify the products sorting on the shop page to product categories filter where the user can select the browse the products of categories from there.

I am a rookie in programming. I checked the WooCommerce directory to find the .php file I should work on. I got some clue it is in archive-product.php but I don't see the code which display the sorting dropdown.

Can anyone give me some clue to achieve this ? Or is there any workaround ? Thanks.



via Chebli Mohamed

Wordpress json api error while generate_auth_cookie

I'm having problem with wordpress json Api When login the user. Currently I'm Using Wordpress version 4.5.1 with listed below plugin:

Here are the step I follow:

1) Generate nonce

http://ift.tt/1UlheoP

Below is Response:

{"status":"ok","controller":"user","method":"generate_auth_cookie","nonce":"4d080ff7b8"}

2) Generate Auth Cookie

http://ift.tt/1UlheoT

Below is Response:

{"status":"error","error":"SSL is not enabled. Either use _https_ or provide 'insecure' var as insecure=cool to confirm you want to use http protocol."}

Why I'm Getting this error?



via Chebli Mohamed

WordPress How to make URL that go on Plugin method

Actually I want to make a such type of URL in wordpress that when I click on Anchor Text then it will go on plugin method. Where I will keep my logic and then it will redirect to my previous URL. I need to complete this task on Woo Commerce Subscription Plugin.

Any help will be appreciating.

thanks



via Chebli Mohamed

how do I create android app using wordpress database?

I had completed my website in wordpress,so can I use my wordpress database to connect android app? how? give me perfect references.



via Chebli Mohamed

jeudi 28 avril 2016

One voucher for several stores

Is there any out-of-the-box woocommerce plugin(or other) where the customer could buy a voucher or coupon and then use it let's say 5 times in different shops ?

Example:

  1. The visitor buys a voucher
  2. The visitor has now the option to use it 3 times among 50 stores
  3. He chooses a gym class today
  4. A week later he uses it for clothes
  5. 2 months later he... goes to the cinema
  6. His voucher should now be expired.

Thanks!



via Chebli Mohamed

create a post in Wordpress with an external script

I am making a java script to create a few posts in a Wordpress blog by only inserting them into the wp_posts so table. So far I could browse the posts on web browser. Question is, is it good enough with the db operations ? does anyone know any other subsequent tables need to be updated for making a post ?



via Chebli Mohamed

modifying wordpress rss plugin (PHP) to organize data

I am working with an rss plugin (http://ift.tt/1DnZdcp). I am using it to display jobs available from a database. The problem I am having is, I need the fields in the table to be organized differently. I will provide images of what I mean. I have been taking a look at the source code provided by the programmer. It is written in php. I cannot quite figure out how to reorganize the data it is retrieving the the website.

This is the how the rss feed looks like on my site.

Here is the PHP code`

<?php
add_action( 'wp_enqueue_scripts', 'wp_rss_retriever_css');

function wp_rss_retriever_css() {
    global $post;
    if( has_shortcode( $post->post_content, 'wp_rss_retriever') ) {
        wp_enqueue_style('rss-retriever', plugin_dir_url( __FILE__) . 'inc/css/rss-retriever.css');
    }
}

add_shortcode( 'wp_rss_retriever', 'wp_rss_retriever_func' );

function wp_rss_retriever_func( $atts, $content = null ){
    extract( shortcode_atts( array(
        'url' => '#',
        'items' => '10',
        'orderby' => 'default',
        'title' => 'true',
        'excerpt' => '0',
        'read_more' => 'true',
        'new_window' => 'true',
        'thumbnail' => 'false',
        'source' => 'true',
        'date' => 'true',
        'cache' => '43200'
    ), $atts ) );

    update_option( 'wp_rss_cache', $cache );

    //multiple urls
    $urls = explode(',', $url);

    add_filter( 'wp_feed_cache_transient_lifetime', 'wp_rss_retriever_cache' );

    $rss = fetch_feed( $urls );

    remove_filter( 'wp_feed_cache_transient_lifetime', 'wp_rss_retriever_cache' );

    if ( ! is_wp_error( $rss ) ) :

        if ($orderby == 'date' || $orderby == 'date_reverse') {
            $rss->enable_order_by_date(true);
        }
        $maxitems = $rss->get_item_quantity( $items ); 
        $rss_items = $rss->get_items( 0, $maxitems );
        if ( $new_window != 'false' ) {
            $newWindowOutput = 'target="_blank" ';
        } else {
            $newWindowOutput = NULL;
        }

        if ($orderby == 'date_reverse') {
            $rss_items = array_reverse($rss_items);
        }

    endif;
    $output = '<div class="wp_rss_retriever">';
        $output .= '<ul class="wp_rss_retriever_list">';
            if ( !isset($maxitems) ) : 
                $output .= '<li>' . _e( 'No items', 'wp-rss-retriever' ) . '</li>';
            else : 
                //loop through each feed item and display each item.
                foreach ( $rss_items as $item ) :
                    //variables
                    $content = $item->get_content();
                    $the_title = $item->get_title();
                    $enclosure = $item->get_enclosure();

                    //build output
                    $output .= '<li class="wp_rss_retriever_item"><div class="wp_rss_retriever_item_wrapper">';
                        //title
                        if ($title == 'true') {
                            $output .= '<a class="wp_rss_retriever_title" ' . $newWindowOutput . 'href="' . esc_url( $item->get_permalink() ) . '"
                                title="' . $the_title . '">';
                                $output .= $the_title;
                            $output .= '</a>';   
                        }
                        //thumbnail
                        if ($thumbnail != 'false' && $enclosure) {
                            $thumbnail_image = $enclosure->get_thumbnail();                     
                            if ($thumbnail_image) {
                                //use thumbnail image if it exists
                                $resize = wp_rss_retriever_resize_thumbnail($thumbnail);
                                $class = wp_rss_retriever_get_image_class($thumbnail_image);
                                $output .= '<div class="wp_rss_retriever_image"' . $resize . '><img' . $class . ' src="' . $thumbnail_image . '" alt="' . $title . '"></div>';
                            } else {
                                //if not than find and use first image in content
                                preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $content, $first_image);
                                if ($first_image){    
                                    $resize = wp_rss_retriever_resize_thumbnail($thumbnail);                                
                                    $class = wp_rss_retriever_get_image_class($first_image["src"]);
                                    $output .= '<div class="wp_rss_retriever_image"' . $resize . '><img' . $class . ' src="' . $first_image["src"] . '" alt="' . $title . '"></div>';
                                }
                            }
                        }
                        //content
                        $output .= '<div class="wp_rss_retriever_container">';
                        if ( $excerpt != 'none' ) {
                            if ( $excerpt > 0 ) {
                                $output .= esc_html(implode(' ', array_slice(explode(' ', strip_tags($content)), 0, $excerpt))) . "...";
                            } else {
                                $output .= $content;
                            }
                            if( $read_more == 'true' ) {
                                $output .= ' <a class="wp_rss_retriever_readmore" ' . $newWindowOutput . 'href="' . esc_url( $item->get_permalink() ) . '"
                                        title="' . sprintf( __( 'Posted %s', 'wp-rss-retriever' ), $item->get_date('j F Y | g:i a') ) . '">';
                                        $output .= __( 'Read more &raquo;', 'wp-rss-retriever' );
                                $output .= '</a>';
                            }
                        }
                        //metadata
                        if ($source == 'true' || $date == 'true') {
                            $output .= '<div class="wp_rss_retriever_metadata">';
                                $source_title = $item->get_feed()->get_title();
                                $time = $item->get_date('F j, Y - g:i a');
                                if ($source == 'true' && $source_title) {
                                    $output .= '<span class="wp_rss_retriever_source">' . sprintf( __( 'Source: %s', 'wp-rss-retriever' ), $source_title ) . '</span>';
                                }
                                if ($source == 'true' && $date == 'true') {
                                    $output .= ' | ';
                                }
                                if ($date == 'true' && $time) {
                                    $output .= '<span class="wp_rss_retriever_date">' . sprintf( __( 'Published: %s', 'wp-rss-retriever' ), $time ) . '</span>';
                                }
                            $output .= '</div>';
                        }
                    $output .= '</div></div></li>';
                endforeach;
            endif;
        $output .= '</ul>';
    $output .= '</div>';

    return $output;
}

add_option( 'wp_rss_cache', 43200 );

function wp_rss_retriever_cache() {
    //change the default feed cache
    $cache = get_option( 'wp_rss_cache', 43200 );
    return $cache;
}

function wp_rss_retriever_get_image_class($image_src) {
    list($width, $height) = getimagesize($image_src);
    if ($height > $width) {
        $class = ' class="portrait"';
    } else {
        $class = '';
    }
    return $class;
}

function wp_rss_retriever_resize_thumbnail($thumbnail) {
    if (is_numeric($thumbnail)){
        $resize = ' style="width:' . $thumbnail . 'px; height:' . $thumbnail . 'px;"';
    } else {
        $resize = '';
    }
    return $resize;
}

Here is the css file that came with the source code:

.wp_rss_retriever li {
    margin-bottom: 10px;
}

a.wp_rss_retriever_title {
    display: block;
    margin-bottom: .5em;
}

/* Crop image to be a thumbnail */
.wp_rss_retriever_image {
    position: relative;
    float: left;
    margin-right: 1em;
    margin-bottom: 1em;
    width: 150px;
    height: 150px;
    overflow: hidden;
}

.wp_rss_retriever_image img {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 100%;
  max-width: none;
  max-height: none;
  width: auto;
  -webkit-transform: translate(-50%,-50%);
      -ms-transform: translate(-50%,-50%);
          transform: translate(-50%,-50%);

}

.wp_rss_retriever_image img.portrait {
  width: 100%;
  height: auto;
}

a.wp_rss_retriever_readmore {
    display: inline-block;
}

.wp_rss_retriever_metadata {
    margin: .5em 0;
    font-size: 85%;
}

/* Clear floats */
.wp_rss_retriever ul:before,
.wp_rss_retriever li:after,
.wp_rss_retriever_metadata:after,
.wp_rss_retriever_metadata:before {
    content: '';
    display: table;
    clear: both;
}



via Chebli Mohamed

Multiple Form on Page Wordpress

There are two forms on the same page. I do not know Is it relevant to the style or template file.I got the same error when I delete the style file. What do you think could be the problem?

Thanks!

There are two forms on the same page. Like this>



via Chebli Mohamed

Custom Worpdress Plugin Call Ajax Return 0

Custom Worpdress Plugin Ajax Call return 0. Main File as Bellow.

<?php
/*
Plugin Name: XYZ
*/

class GMS_SMS_Notifier {


public function __construct(){
    if (is_admin()){
        //JS
        add_action( 'admin_enqueue_scripts',array($this,'load_custom_js_scripts'));
    }


function load_custom_js_scripts() {
    wp_register_script( 'gms_custom', plugins_url('/assets/js/gms_custom.js', __FILE__ ),false,'1.0',true);
    wp_localize_script('gms_custom','plugin_ajax',array('ajaxurl'=>admin_url('admin-ajax.php')));
    wp_enqueue_script('gms_custom');

}

function mail_send_to(){
    global $wpdb;
    echo $_POST['recordID'].'Hello';
    die();

add_action('wp_ajax_mail_send_to','mail_send_to');
add_action('wp_ajax_nopriv_mail_send_to','mail_send_to');

} // End Class GMS_SMS_Notifier

new GMS_SMS_Notifier();

Custom Function do not want to add function in theme function.php

JS file gms_custom.js as bellow

$(".send_mail_btn").click(function(){
var recordids = $(this).attr("id");

    $.ajax({
        url: plugin_ajax.ajaxurl,
        type: 'POST',
        data: ({
        action: 'mail_send_to',
        recordID: recordids,
        }),
        success: function(data) {
            console.log(data);
       }
   });
});

Problem: Custom Function put on theme function.php working fine.but when put on plugin file that not working. I wan't same file

Given me your suggestion.

Thanks.



via Chebli Mohamed

sitemap_7.php file found via Google Fetch, can't find/access in browser/FTP/SSH

I'm pulling my hair out right now and I can't seem to narrow down this hack.

Google Fetch & Render inside Webmaster Tools is finding a /sitemap_7.php file on our server that just isn't there -- in either the files via the browser/ftp/ssh.

http://ift.tt/1SSFKP2

I've scanned the site in every way I can. I just can't find the file.

Can anyone help?



via Chebli Mohamed

WordPress Update User Meta Front End Profiles

i created a plugin to create a user profile page. On this the user is able to update custom meta information through a form. Here is my function:

// Function to edit User Meta

function personalfragebogen_konto_bearbeiten() {

global $current_user;

// Get User Meta

$strasse = get_user_meta( $current_user->ID, '_strasse', true);

// Create Form

<form name="personalfragebogen" action="" method="POST">

    <span class="full" >
        <span class="two_fifth first">
            <h3><?php _e( 'Straße:', 'themesdojo' ); ?></h3>
        </span>

        <span class="three_fifth">
            <input type="text" name="strasse" id="strasse" value="<?php echo $strasse; ?>" class="input-textarea"/>
        </span>
    </span>

<button type="submit">Speichern</button>

</form>

// Get New User Meta

$strasse = $_POST['strasse'];

// Update/Create User Meta

update_user_meta( $current_user->ID, '_strasse', $strasse); 

// Add Hook

add_action( 'personalfragebogen_init', 'personalfragebogen_konto_bearbeiten');

function personalfragebogen_init() {
    do_action('personalfragebogen_init');
}

Everything works fine, except of one thing. When I submit the form the data saves to the database and the page refreshes. But now on my refreshed page the form is empty. When refresh the page again then the data is shown. Whats the problem about this?

Thank you in advance!



via Chebli Mohamed

How to make EU cookies law in WP stay in the middle of the screen

I have got css for Wordpress EU cookies - displaying COOKIES BAR. The problem is that the text area disappers when on mobiles or smaller resolution. In fact it stays at the same place and I wanna center it so it would stay in the middle of the page.

check this PICTURE PLEASE http://ift.tt/1WUisIw



via Chebli Mohamed

Gravity form gform_after_submission woocommerce not working

I have a problem linking my the Gravity Forms' gform_after_submission form/action with the products in WooCommerce.

I've inserted this code in my functions.php

add_action("gform_after_submission_49", "set_post_content", 10, 2);
function wdm_attribute_filter($entry, $form){

    //getting post
    $post = get_post($entry["post_id"]);
    $scelta = $entry[9];

    $loop = new WP_Query( array( 
        'post_type' => 'product',    
        'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'concern',
            'field' => 'slug',
            'terms' => $concern
        ),
        ),

        'orderby' => 'title',
        'posts_per_page' => '-1', 
        'order' => 'ASC'
      ) 
   );
}

But it's not working.



via Chebli Mohamed

How specify which post type the user can edit it in wordpress

i'm working on wordpress ,and i'm using Custom Post Type UI plugin, i have the following custom post type :

  • News
  • Videos
  • Images

for example i want to allow user1 to add/view News and deny for Videos, as well as user2 can add/view Videos and cannot for News



via Chebli Mohamed

WP function get_error_message() returns message always in english

I use qTranslate-X and a custom login form for users. If user login or password is incorrect i have called get_error_message() for message displaying. It all times return english string.

I have tried define ('WPLANG', 'ru_RU'), but still not working



via Chebli Mohamed

Unnecessary Unknown images are appear in Wordpress

I got the unknown and unnecessary files on wordpress media and there is no option too to delete these files. How can i delete these files help me please ! enter image description here



via Chebli Mohamed

Dilemma plugin customization please help me...!

thanks for responding advance i need thus feature in my site. i needs to be any visitors to vote and share a dilemma on social media, no registration necessary. The 6 additional features I want are these: 1.I need each dilemma to have a visible 24 hours countdown then delete itself permanently

2.I want to be able to add dilemmas with 2 pictures quickly with categories.

3.I want visitors to vote first before they see the results (Each dilemma will just show just the total number of voters first, then the results after the vote is submitted) and each visitors vote only once for each dilemma (cookie).

4.I want people who voted to be able add their email to receive the final results when the countdown is finished (optional), and add a password to create an account (optional) for next dilemmas.

  1. I would like visitors to have a form to create their own dilemma and get a link for it, free for basic dilemmas with 24 hours countdown, and premium for longer ($1 for 3 days, $5 for 7 days, $9 for 15 days, $15 for 30 days).

my website is there: http://pickstagram.com/ plugin demo:http://ift.tt/1m704rT

thanx again



via Chebli Mohamed

mercredi 27 avril 2016

Script wont work when passed to wp_enqueue_script

After realizing i need to use the wp_enqueue_script for any javascript on my website, I have begun trying to use the wp_enqueue_script and am getting no where.

my .php file contains:

<?php
function EnactScript(){
    wp_register_script('CommercePlugin', plugins_url('js/CouponGenerator.js', __FILE__), array('jquery'), '', false);
    wp_enqueue_script('CommercePlugin');
}
add_action('wp_enqueue_scripts', 'EnactScript');
function GenCoupon(){
echo "<input type = \"button\" onclick = \"randomCoupGen(); this.disabled = true\">Click here to see if you won!!</input>";
echo '<imgr src="' . plugins_url('js/CouponGenerator.js', __FILE__) . '" > ';
}
add_filter('woocommerce_before_checkout_form', 'GenCoupon', 9999999, 2);
?>

This it the CouponGenerator.js code:

<html>
<head>
<script type = "text/javascript">
function randomCoupGen()
{
var RanNum = Math.floor(Math.random() * 6);
if(RanNum == 1)
{
alert("You rolled a 1");
}
else if(RanNum == 2)
{
alert("You rolled a 2.");
}
else
{
alert("You rolled something other than 1 or 2");
}
}
</script></head><body></body></html>

What do I need to do to make sure my JS is getting loaded when wp_head(); is called?



via Chebli Mohamed

add_action( 'wp', function) removes

I got an issue in my site it removes the <!DOCTYPE html> in my html source, and the culprit is my new added hook for my custom plugin that shows loading screen when the page is loading.

This is my code:

function smrs_loading_screen() {
    session_start();
    $data = get_WordPress_Axcelerate_Login_Widget_Settings();
    $set_options = get_WordPress_Axcelerate_Link_SRMS_Optiont_Settings();
    $val = '<p id="loading-text">'.$set_options[0].'</p>';
    if(get_the_ID() == $data[4]){
        echo '<div id="loadings">'.(($_POST['srmsform_type'] == 'registrationAndEnrrollment')? $val: '').'</div>';
        echo '<script>';
        echo 'function onReady(callback) {';
            echo 'var intervalID = window.setInterval(checkReady, 1000);';
            echo 'function checkReady() {';
                echo "if(document.getElementsByTagName('body')[0] !== undefined) {";
                    echo 'window.clearInterval(intervalID);';
                    echo 'callback.call(this);';
                echo '}';
            echo '}';
        echo '}';

        echo 'function show(id, value) {';
            echo 'var cls = document.getElementsByClassName("entry-content")[0];';
            echo 'if(cls){';
                echo "document.getElementById(id).style.display = value ? 'block' : 'none';";
            echo '}';
        echo '}';

        echo 'onReady(function () {';
            echo "show('loadings', false);";
        echo '});';

    echo '</script>';
    }
}
add_action( 'wp', 'smrs_loading_screen' );

question, is there any other way I can put my loading screen that shows when the content still loading and the <!DOCTYPE html> won't remove?



via Chebli Mohamed

How to connect background of one post with another with making shapes in wordpress website? I have attached an image of that

Sorry I couldn't express it clearly. But I have attached image to get the view of what I'm asking.Image here



via Chebli Mohamed

How can I make the image fill the whole container?

I want to make the image always fill width and height.

I am using LayerSlider WP plugin so I set width 100% at its settings and also width: 100% !important into a field that says "custom css"

PS: This is the link http://ift.tt/1pFyMiD (you will see I added a very small and squared image in the first slide and a wider image for the second one but still doesnt fill the full width)

Thanks !



via Chebli Mohamed

wordpress wpdb - get_results as json

A json string is stored in a custom table field. When I try to retrieve it, some slashes get added:

[{"parameters":"{\"mytext1\":\"la ciudad..\",\"mytext2\":\"la playa\",\"mytext3\":\"la escuela\"}"},{"parameters":"{\"tipoOperacion\":\"suma\",\"decimales\":\"s\\u00ed\",\"numeros\":\"d0-100\"}"},{"parameters":"{\"direction\":\"EsteOeste\"}"},{"parameters":"{\"direction\":\"EsteOeste\"}"}]

Using stripslashes_deep or stripslashes actually remove slashes, but also create an invalid json string.

How can I process this text in order to get a working json string?



via Chebli Mohamed

WordPress theme and plugin to create user guide

I wish to create an interactive user guide using WordPress with images, videos etc. I have tried to read about it online and found a plugin called Documentor

However, I was wondering if there was a complete theme that I could use. I wish to make it interactive, intuitive and visually appealing.

It would be great if anyone could suggest a theme/plugin that would help me get there



via Chebli Mohamed

Show minimum price for WooCommerce variable products (Version 2.5.5)

I am using the latest version of WooCommerce-2.5.5. But, it showing the maximum price for the variable product in shop and single product page (http://ift.tt/1T4kShH, http://ift.tt/1SP7PXn). But I want to show the minimum price for the variable product.

I have tried many hooks for showing the minimum price but not working (like http://ift.tt/1T4kShL and so many hooks). I have tried WooCommerce 2.1 variation price, revert to 2.0 format (http://ift.tt/1SP7PXt) which also not working.

Can anyone please help me to solve the problem for showing the minimum price for the variable products instead of maximum price.

Regards.



via Chebli Mohamed

mardi 26 avril 2016

Deactivate a choice of a radio buttons field

Is there a way to deactivate one (or several choices) of a radio buttons field without hiding it (or them) ? In order to keep it visible to the user but with no possibility to select it.

I want to deactivate this radio button. 5/20(東京) 15:00〜17:00 オーナー様説明会へ参加します

Im using gravity form plugin, so please let me know.

Form Url : http://ift.tt/1VRJ3a1



via Chebli Mohamed

How do i create android application to integrated with wordpress?

1)How do I create android application which integrated with wordpress website? and please give me perfect solution and references.

2)I had completed my wordpress websites and also try simple plugin of wordpress json api.

*http://ift.tt/1T3PrEh

3) I found where i need to create my custom web services so if i got something that create my own custom web service which I used in my application.

4) I tried to fix it with simple static data but I realise that it would give bad impression and helpless app if I do that.

5) Give me any reference and perfect example regarding android application integrated with wordpress.



via Chebli Mohamed

Using Include Files with PHP Associative Array

I have an event listing page in a wordpress plugin I mage that is showing a date with times for that date.It shows 14 days worth.

I’ve used an associated array to grab the server date and strip it down to a number. Each day has an include file associated with it.

I’m trying to get it to sort those dates and then include that file so it will show.

When use the following code, it works fine. Shows the key, date, value and name of the include for all the 14 days.

$compare = array($getshow1=>("day1.php"),$getshow2=>("day2.php"),$getshow3=> ("day3.php"),$getshow4=>("day4.php"),$getshow5=>("day5.php"),$getshow6=>("day6.php"),$getshow7=>("day7.php"),$getshow8=>("day8.php"),$getshow9=>("day9.php"),$getshow10=>("day10.php"),$getshow11=>("day11.php"),$getshow12=>("day12.php"),$getshow13=>("day13.php"),$getshow14=>("day14.php")); 

ksort($compare);

foreach($compare as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}

However when change it to the following sorth to try and use the includes, it works but for some reason only shows on about half of the 14.

ksort($compare);

foreach($compare as $x => $x_value) {
include $x_value;

}

I’m thinking there is some function I need to use but I’ve working on this a while now and think I have code block. Any help would be appreciated.



via Chebli Mohamed

I need to show DWQA categories

I am using DW Question & Answer Plugin.

I need to show categories in my sidebar category widget. But it is showing 'No Categories' whether there are categories and those categories already assigned for questions.

How can I show categories in my category widget..?

Thanks



via Chebli Mohamed

Exclude product when bundled by WooCommerce

I have WooCommerce products structured similarly to the following:

Product A - Bundle including products B and C
Product B - Simple Product
Product C - Simple Product

If a user adds Product B to the cart, and then decides to add the bundle, they now have Product B included in the cart twice. Once in the bundle, but also individually.

Is there a way I can forcibly remove the single instance of Product B so they don't pay for it a second time? I couldn't find any pages detailing such a process nor did I see options in WooCommerce itself, but I could have overlooked it.



via Chebli Mohamed

Wordpress Video Player Suggestion

I need a plugin for wordpress website which have following qualities:

  1. subtitles
  2. quality selecttion

Can any one help?



via Chebli Mohamed

wordpress bulk edit action not apply for all posts selected

I want to write a plugin for wordpress that it can when i edit bulk action, add a tag to all posts selected. this is a sample that i write, but it just add a tag to one post While I want this apply for all posts selected!

add_action('bulk_edit_custom_box', 'bulk_test');
function bulk_test(){
$post_ID = get_the_ID();
wp_set_post_tags($post_ID,'test',true );
}



via Chebli Mohamed

Risks about edit the source code of a Wordpress plugin

I am making my first steps coding. I made some courses on Internet, and now I started to make a Wordpress theme to continue learning from the practice.

I find that there is a lot of Plugins that can help me to achieve the goals that I want, and I also found a plugin that makes almost everything that I want.

I started to modify the source code of that plugin so it could fits in my design scheme. Now I don't know if it is a good idea.

I didn't find a way to make a "child plugin" so at this moment I don't know if continue editing the source of this plugin, (that means that I would never update my plugin because I would lose all the modifications) or simply make everything by my own that would take me a lot more of time.

Do you have some suggestion?



via Chebli Mohamed

PHP Textarea line break

Hi i have this code in wordpress plugin,

<div class="column one-half">
    <label><?php _e('Sub Title','dt_themes');?></label>
</div>
<div class="column one-half last">
    <?php $v = array_key_exists("subtitle", $catalog_settings) ?  $catalog_settings['subtitle'] : '';?>
    <textarea id="subtitle" name="_subtitle" class="large" rows="3" style="width:100%;"><?php echo $v; ?></textarea>
    <p class="note"> <?php _e("You can given your sub title",'dt_themes');?> </p>
</div>

I am not able to make line break in text area while inputting text. Please help



via Chebli Mohamed

How to generate Retrofit client library from wp rest api using swagger

I am creating android client for my WordPress website . Is there a way to generate retrofit 2 client library from wp rest client using swagger or is there any other tool to generate the same .



via Chebli Mohamed

WooCommerce Composite Product Page has unwanted "QTY" input field above Add To Cart

Consider these two composite products, which were created to be identical in every way, except for the product name, sku, image, and options.

Even the composite options are more or less copies, the second one a copy from the first, except for the changes to the component names, prices, skus, etc.

The composite product on this link is correct, because immediately above the ADD TO CART button, there isn't a quantity select:

26″ PATIO FR ON BLACK PEDESTAL

The composite product on this link, on the other hand, has a quantity select input immediately above the ADD TO CART. I don't want it, and I want to remove it:

26” PATIO

I have put the two product pages side-by-side, using the edit product page, compared the products at every level I can think of, comparing the component construction, the advanced tab of each component, and even comparing the components side-by-side (each component being a simple product), and I can't see any difference.



via Chebli Mohamed

how to use mycred api into Android app

I have a button on my HTML page and I am showing this in webview in Android app. I want that if I click on button the android/ios payment popup should open and let them pay 5$ and then we add 100 points to their account.

Please anyone give me some documentation to implement this scenario.



via Chebli Mohamed

Why is WordPress 4.5's New JSON Data Handling Breaking My Plugin?

In version 4.5, WordPress changed how it handles POST data in the edit menu items page. Ok, cool. However, for some reason their change broke my plugin and I don't understand why or how to unbreak it. An array of items entered on the menu items page no longer saves to the database.

Here's the culprit change in WP 4.5:

/*
 * If a JSON blob of navigation menu data is found, expand it and inject it
 * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. 
 */
if ( isset( $_POST['nav-menu-data'] ) ) {
    $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) );
    if ( ! is_null( $data ) && $data ) {
        foreach ( $data as $post_input_data ) {
            // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex.
            if ( preg_match( '#(.*)(?:\[(\d+)\])#', $post_input_data->name, $matches ) ) {
                if ( empty( $_POST[$matches[1]] ) ) {
                    $_POST[$matches[1]] = array();
                }
                $_POST[$matches[1]][(int)$matches[2]] = $post_input_data->value;
            } else {
                $_POST[$post_input_data->name] = $post_input_data->value;
            }
        }
    }
}

See: http://ift.tt/20Ydjj4 When I delete the new code from WordPress Core it works fine.

My plugin asking for user data (an array of locations):

<select name="menu-item-visibility[<?php echo $item_id; ?>][]" id="edit-menu-item-visibility-<?php echo $item_id; ?>" class="chzn-select" multiple="true">
<?php
$vals = get_post_meta( $item_id, 'locations', true );
foreach( $countries as $key => $value ) { 
?>
    <option value="<?php echo $key;?>"<?php echo is_array( $vals ) && in_array( $key, $vals ) ? "selected='selected'" : ''; ?>> <?php echo $value;?> </option>
<?php
}
?>
</select>

And trying to put it in the database:

/* Put locations in the database. */
function csmi_update_locations( $menu_id, $menu_item_db_id, $args ) {
    $meta_value = get_post_meta( $menu_item_db_id, 'locations', true );
    if ( isset( $_POST[ 'menu-item-visibility' ][ $menu_item_db_id ] ) ) { 
        $new_meta_value = $_POST[ 'menu-item-visibility' ][ $menu_item_db_id ];
    }
    if ( !isset($new_meta_value ) ) {
    delete_post_meta( $menu_item_db_id, 'locations', $meta_value );
    }
    elseif ( $meta_value !== $new_meta_value ) {
        update_post_meta( $menu_item_db_id, 'locations', $new_meta_value );
    }
}

See: http://ift.tt/1MVk56C

Any idea why it's not saving?



via Chebli Mohamed

Revolution slider don't shows all slides

I have Revolution Slider's based wordpress galleries.

example slider

Sliders with few slides, like up to 10 images works perfectly, but when the gallery has more images (more than 10) these are shown to be active referring to the bullet counts, but they don't show up. Only the first 10 slides are shown.

Any idea how solve this?



via Chebli Mohamed

Page builder not updating Page content

Hello I am using Page builder plugin (version 2.4.6). But i can not update my page content. If I change my page content it is set back to blank. I have updated plugin. I have deactivate all other plugin but same things happen.

Why the page content not updated ? Even I can not see the two button (History and Live Editor button) in editor.

I am using wordpress plugin 4.3.1 version.



via Chebli Mohamed

lundi 25 avril 2016

How to Edit Wordpress plugin css file?

I am new in technology field. So, My question may look funny. But, I have wasted a lot of time. So, finally i decided to take help from you guys.

Let me give you some important points that i have done, so that you can understand it what i want to ask.

I want to create a website using wordpress and bluehost for hosting. So, I went to bluehost website, Bought a domain and installed wordpress from there. Then, I went to http://ift.tt/1NMsP9S, logged in there. I chose my desired theme and some plugin.

Now, I want to edit css file of a plugin(Name is syntaxhighlighter). But, I am not able to find the css file. Can you guys help me to find it? If you have any tutorial link please send me.

Also, my website is not live. As many tutorials suggested, I Checked in cpanel of bluehost account, But, din't find anything there.

Am i missing some steps in order to create a website? Some tutorials were using localhost to edit plugin css. As i am newbie in this field, I couldn't get how to use localhost to edit css file? If you have any idea, Please share with me.



via Chebli Mohamed

Wordpress Option Tree plugin not save key values

I use this plugin for save values for my theme , actually in localhost in my server works fine , but when i install in production server not works

The problem it´s with the keys , if i build a key with "_" no problem for works but if in produxction server i use key with "-" not save never the value , this problem only when install system in production server

For example this :

  array(
        'id'          => 'tpe-carousel-front',
        'label'       => 'CarouselFront',
        'default'     => 'Carousel Front Web',
        'type'        => 'textarea-simple',
        'section'     => 'caroufront'
    ),

This works for me in localhost but no in production server , but if i use "_" and not "-" , in production server works , i don´t understand why happend this , i try all and continue with this problem

Thank´s for the help , regards



via Chebli Mohamed

Remove LayerSlider WP gap on the left

I am dealing with this problem for weeks. If you see on the top of my blog http://ift.tt/1YQsTeG you will notice the there is a gap on the left. I already consulted the support team of Kresi (The 3rd party company who included this plugin into their theme) but they couldn't find a solution yet. This is the link for the ticket I submitted to them (http://ift.tt/1NtSxoD).

I guess this might have something to do with the fact that it's set to dynamically show new posts because this didn't happen to me with other banners I created (same plugin)

Any idea ?

Thanks !

Ariel



via Chebli Mohamed

Metabox save method dont work for me

I am trying to make a metabox class, everything is ok in my function method but my save method in my class dont work, someone please give me a solution where is the problem in my save function ? my code is given bellow

    <?php

if ( ! class_exists( 'Metabox_Library') ) :

/**
 * All Types Meta Box class.
 *
 * @package All Types Meta Box
 * @since 1.0
 *
 * @todo Nothing.
 */

class Metabox_Library
{

      /**
   * Holds meta box object
   *
   * @var object
   * @access protected
   */
    protected $meta_box;

  /**
   * Holds meta box fields.
   *
   * @var array
   * @access protected
   */
    protected $_prefix;

  /**
   * Holds Prefix for meta box fields.
   *
   * @var array
   * @access protected
   */
    public $fields = array();

  /**
   * Use local images.
   *
   * @var bool
   * @access protected
   */

   /**
   * $field_types  holds used field types
   * @var array
   * @access public
   * @since 2.9.7
   */
    public $field_types = array();



    public function __construct($metabox,$meta_fields) {
        // Assign meta box values to local variables and add it's missed values.
        $this->meta_box = $metabox;
        $this->prefix = (isset($metabox['prefix'])) ? $metabox['prefix'] : '';
        $this->fields = $meta_fields;

        foreach ($this->fields as $field) {
            $this->field_types = $field['type'];
        }
        // If we are not in admin area exit.
        if ( ! is_admin() )
          return;

        // Add metaboxes
        add_action( 'add_meta_boxes', array( $this, 'add_metabox' ) );


            add_action('save_post', array($this, 'save_custom_meta'));
            // Must enqueue for all pages as we need js for the media upload, too.
        if ($this->is_edit_page()) {
            add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
            add_action( 'admin_head', array($this,'add_custom_scripts'));
            }       


    }

    public function fields_type() {
        foreach ($this->fields as $field) {
            $this->field_types = $field['type'];
        }
    }

    public function add_metabox($postType) {
        if (in_array($postType, $this->meta_box['pages'])) {


            add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'show_fields' ),$postType, $this->meta_box['context'], $this->meta_box['priority'] );


        }
    }

    public function show_fields() {

        global $post;
        $fields = $this->fields;
    // Use nonce for verification
    echo '<input type="hidden" id="custom_meta_box_nonce" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';

        // Begin the field table and loop
        echo '<table class="form-table">';
        if (is_array($fields) || is_object($fields)) {

            foreach ($fields as $field) {
                // get value of this field if it exists for this post
                $meta = get_post_meta($post->ID, $field['id'], true);
                // begin a table row with
                echo '<tr>
                        <th><label for="'.$field['id'].'">'.$field['label'].'</label></th>
                        <td>';
                        switch($field['type']) {

                            // text
                            case 'text':
                                echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
                                    <br /><span class="description">'.$field['desc'].'</span>';
                            break;
                            // textarea
                        case 'textarea':
                            echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
                                <br /><span class="description">'.$field['desc'].'</span>';
                        break;

                        // select
                        case 'select':
                            echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
                            foreach ($field['options'] as $option) {
                                echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
                            }
                            echo '</select><br /><span class="description">'.$field['desc'].'</span>';
                        break;

                        // checkbox
                        case 'checkbox':
                            echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>
                                <label for="'.$field['id'].'">'.$field['desc'].'</label>';
                        break;

                        // radio
                        case 'radio':
                            foreach ( $field['options'] as $option ) {
                                echo '<input type="radio" name="'.$field['id'].'" id="'.$option['value'].'" value="'.$option['value'].'" ',$meta == $option['value'] ? ' checked="checked"' : '',' />
                                        <label for="'.$option['value'].'">'.$option['label'].'</label><br />';
                            }
                        break;
                        // checkbox_group
                        case 'checkbox_group':
                            foreach ($field['options'] as $option) {
                                echo '<input type="checkbox" value="'.$option['value'].'" name="'.$field['id'].'[]" id="'.$option['value'].'"',$meta && in_array($option['value'], $meta) ? ' checked="checked"' : '',' /> 
                                        <label for="'.$option['value'].'">'.$option['label'].'</label><br />';
                            }
                            echo '<span class="description">'.$field['desc'].'</span>';
                        break;
                        // tax_select
                        case 'tax_select':
                            echo '<select name="'.$field['id'].'" id="'.$field['id'].'">
                                    <option value="">Select One</option>'; // Select One
                            $terms = get_terms($field['id'], 'get=all');
                            $selected = wp_get_object_terms($post->ID, $field['id']);
                            foreach ($terms as $term) {
                                if (!empty($selected) && !strcmp($term->slug, $selected[0]->slug)) 
                                    echo '<option value="'.$term->slug.'" selected="selected">'.$term->name.'</option>'; 
                                else
                                    echo '<option value="'.$term->slug.'">'.$term->name.'</option>'; 
                            }
                            $taxonomy = get_taxonomy($field['id']);
                            echo '</select><br /><span class="description"><a href="'.get_bloginfo('url').'/wp-admin/edit-tags.php?taxonomy='.$field['id'].'">Manage '.$taxonomy->label.'</a></span>';
                        break;


                        } //end switch
                echo '</td></tr>';
            } 
        }// end foreach
        echo '</table>'; // end table
    }


    public  function save_custom_meta($post_id) {
            global $post_id;

            // verify nonce
            if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__))) 
                return $post_id;
            // check autosave
            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
                return $post_id;
            // check permissions
            if (isset($_POST['page']) == isset($_POST['post_type'])) {
                if (!current_user_can('edit_page', $post_id))
                    return $post_id;
                } elseif (!current_user_can('edit_post', $post_id)) {
                    return $post_id;
            }

            // loop through fields and save the data
            foreach ($this->fields as $field) {
                $old = get_post_meta($post_id, $field['id'], true);
                $new = isset($_POST[$field['id']]);
                if ($new && $new != $old) {
                    update_post_meta($post_id, $field['id'], $new);
                } elseif ('' == $new && $old) {
                    delete_post_meta($post_id, $field['id'], $old);
                }
            } // end foreach
            if($field['type'] == 'tax_select') continue;
            // save taxonomies
          $post = get_post($post_id);
          $category = $_POST['category'];
          wp_set_object_terms( $post_id, $category, 'category' );
        }



    /**
   * Check if current page is edit page.
   *
   * @since 1.0
   * @access public
   */
     public function is_edit_page() {
        global $pagenow;
        return in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
      }







}


 // End Class
endif; // End Check Class Exists



via Chebli Mohamed

WooCommerce plugin - AJAX and $_SESSION issues

I'm trying to build a plugin that adds some custom data to a WooCommerce order.

Essentially I'm loading a specific product page from a custom button where I have a url variable set (&my_post_var={INTEGER}). This var is then processed in the product page, displaying some specific information available within WordPress, and is working as intended.

From hereon, after pressing Add to Cart, some of the custom data is pushed to the cart session. The AJAX jQuery and PHP callback are both correctly ran and the jQuery response is also correctly populated using PHP $_SESSION variable.

The issue is after that, when the Cart page displays, where the data displayed is the one from the previous &my_post_var={INTEGER} value, not the last value that was being passed.

I'm not using any cache plugins, this is a local development wordpress installation.

Can someone help me out pinpointing what might be wrong here?

This is the part of the code that is probably more pertinent:

function __construct() {

    // AJAX callback    
    function my_ajax_custom_data_callback_inline () {
        session_start();
        print_r ($_POST);

        write_log ( 'Data inside AJAX callback: ');
        write_log ( ' - DEBUG: _POST data: '. $_POST['my_post_data'][0] ); // This outputs the expected value

        $_SESSION['my_meta_data'] = $_POST['my_post_data'];
        print_r ($_SESSION);

        write_log ( ' - DEBUG: _SESSION DATA: ' . $_SESSION['my_meta_data'][0] ); // This outputs the expected value

        wp_die();
    }

    // AJAX hooks
    add_action('wp_ajax_' . 'my_custom_data', 'my_ajax_custom_data_callback_inline', 1);
    add_action('wp_ajax_nopriv_' . 'my_custom_data', 'my_ajax_custom_data_callback_inline', 1);


    if ( isset( $_SESSION['my_meta_data'] ) ) { // this is not being verified as TRUE

        add_filter( 'woocommerce_add_cart_item_data', 'my_add_cart_item_data', 10, 2 );

        add_filter( 'woocommerce_get_cart_item_from_session', 'my_get_cart_items_from_session', 10, 3 );

        add_filter( 'woocommerce_get_item_data', 'my_get_item_data',  10, 2 );

        add_action('woocommerce_add_order_item_meta', 'my_add_values_to_order_item_meta',10,2 );

        add_action('woocommerce_before_cart_item_quantity_zero', 'my_remove_user_custom_data',10,1 );

    }

}

Thank you very much



via Chebli Mohamed

How to convert http to https

1st i want to convert my http domain to https domain and also yo non www to www domain through .htacccess.

1- http://ift.tt/1Tswiid ----> http://ift.tt/1VxbDNz

2- http://ift.tt/1VxbDNz ----> http://ift.tt/1Tswiif

i was coded:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^quickassignmenthelp\.co.uk$ [NC]
RewriteRule ^(.*)$ http://ift.tt/1VxbCcj [R=301,L]

# BEGIN EXPIRES
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 10 days"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/plain "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES



via Chebli Mohamed

Not working checkbox shortcode for wordpress visual composer

I'am making my own and first shortcode for visual composer, and in my functions.php I have:

add_shortcode( 'firsttag', 'firsttag_func' );
function firsttag_func( $atts ) {
   extract( shortcode_atts( array(
      // not important code,
      'checkboxRight' => !empty($checkboxRight) ? '' : 'pull-right',
   ), $atts ) );

   return   "<div class='col-md-12'>".
                "<div class='container container-about'>".
                    "<div class='row'>".
                        "<div class='container'>".
                            "<div class='col-md-6 {$checkboxRight}'>".
                                "<p class='subtitle'>{$beforefoo}</p>".
                                "<p class='title' style='color:{$color};' data-foo='${foo}'>{$foo}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>";}

add_action( 'vc_before_init', 'your_name_integrateWithVC' );
function your_name_integrateWithVC() {
   vc_map( array(
      "name" => __( "PlayFair Heading box", "my-text-domain" ),
      "base" => "firsttag",
      "class" => "",
      "category" => __( "Content", "my-text-domain"),
      'admin_enqueue_css' => array(get_template_directory_uri().'/style.css'),
      "params" => array(
         array(
            "type" => "textfield",
            "holder" => "",
            "class" => "",
            "heading" => __( "PreHeading", "my-text-domain" ),
            "param_name" => "beforefoo",
            "value" => __( "", "my-text-domain" ),
            "description" => __( "Example: Before Name of the text block", "my-text-domain" )
         ),
         // not important arrays,
         array(
            "type" => "checkbox",
            "holder" => "div",
            "class" => "",
            "heading" => __( "Right screen position", "my-text-domain" ),
            "param_name" => "checkboxRight",
            "admin_label" => '',
            "value" =>  array( 'Yes please' => '1'),
            "description" => __( "", "my-text-domain" )
         ).......

I have checked my function part

'checkboxRight' => !empty($checkboxRight) ? ' ' : 'pull-right',

and it's working, but seems that I don't get good value from checkbox array

"admin_label" => '',
"value" => array( 'Yes please' => '1'),

any ideas why ?



via Chebli Mohamed

How to create a QR code Generator using php that has logo in its center, custon color and instead of bars it is made of dots?

I would like to create a wordpress plugin that will generate a qr code that instead of tiny bars it is made up of dots, and there will be a logo in its center. I have a php library to make a qr-code but it only create black and white traditional qr code.

Image

any one help pls.

respect pls



via Chebli Mohamed

Display subcategories in the filter on CPT

I have a little problem with my CPT. I created some categories with subcategories, and I wish display the subcategories in the select filter. Actually, the categories filter display only the first level of categories. I use this plugin, Custom Content Type Manager.

Categories filter:

enter image description here

Categories list:

enter image description here



via Chebli Mohamed

dimanche 24 avril 2016

Wordpress plugin to translate content of post or page

I want to find a plugin to translate content of post or page like base on .po file , not WPML because lot of paragraph has to reuse.



via Chebli Mohamed

Users/cookies across multiple Wordpress installs

I've found some useful information on this subject, but haven't found any solutions that works. I have new installs of wordpress 4.5 on all sites. I want to set up multiple Wordpress Multisite installs and share the same user database as well as cookies so users are signed in as they move from site to site.

Sharing the database tables is easy. However, sharing login status via shared cookies hasn't worked.

I've tried every variation of

define('COOKIE_DOMAIN', '.domain.com');
define('COOKIEPATH', '/'); 
define( 'SITECOOKIEPATH', '/'); 

and a few other and still no go.

Here's what I would like to accomplish: I need to set up a solution where users are shared across several subdomains. The reason for multiple Multisite installs is that each Multisite has a different purpose and requires the ability to set up segregated sites. We still need to use the same main members list and keep members logged in across all the sections. For example, a clubs site at clubs.domain.com where each club has its own site under http://ift.tt/1Nr6cwU. Another subdomains (members.domain.com) will offer the ability for regular members to create pages at http://ift.tt/1SDs07u. Everything about this is easy except keeping members logged in as they move from subdomain to subdomain. Shared user database is easy (more or less), but reporting the login status via cookies hasn't worked.

Any insight is appreciated.



via Chebli Mohamed

Change the website default Language (Wordpress)

In wordpress when I change the default site language to be Italian, my admin panel changed to Italian as well , How I can set two default languages one for the website visitors and the other for the admin panel?



via Chebli Mohamed

Restrict shop manager from woocommerce checkout settings tab

How can I restrict users with a certain role(shop manager) from accessing selected woocommerce settings tabs. I asked a similar question here, but the answer will only hide the tab from showing up but will not restrict the user from the page if he types the url directly.

I can't seem to figure this out.



via Chebli Mohamed

Wordpress JetPack is not working how to solve it?

My wordpress blog Jetpack is not working its says that error in load.php file and when i solve it my wordpress dashboard start showing blank screen my blog url is http://trickytrick.in/



via Chebli Mohamed

samedi 23 avril 2016

Creating custom Wordpress object

I'm putting together my own Wordpress theme for a very specific set of client requirements. I'm fine with front-end theme work, but I need some help with back end.

The task is kind of like a support site, with lots of Q and A's. I'm building a support site for a company, which means most Pages will be populated with many questions and associated answers.

The page Structure would be something like this:

Home Page (with links to Most recent Q+As added) and common sections
-How to use the app (10-20 Q+As on page)
-How to manage integrations (10-20 Q+As on page)
-Other page (10-20 Q+As on page)
-5-10x 'Other pages'
About Us
Contact Support

Requirements and my comments

-Each Q and A does not have it's own URL
This makes using Posts for Q and A's unattractive.

-Each Page is made up of a Table of Contents which allows quick scrolling to questions
An ideal solution would be some code on the page theme template which grabs each "Q and A" object within a certain category/section/identifier and load it to the page

-New questions and answers can quickly and easily be added
The ideal solution for support reps is that they can add a question and answer, and assign a category, rather than edit a huge page of questions.

-Order of Q and A's on page is important
Ideal solution should allow you to order the Q+As within their given category/section/other.

-On the home page, most recent Q+As added list exists

-Each Page of Q+As has a "last updated" date, which is the date the most recent Q+A was most recently modified.


Ideas I had

Posts or custom posts seemed like a good idea, but they create permalinks. But my "Pages" would actually be Category Archive pages. We don't want a Q+A to be be assigned two categories. Also, custom post ordering seems difficult. If we could suppress permalinks and ensure on category or section and find a way to order them - this could work.

FAQ Plugins

It seems like these all are a bit clunky and the amount of custom dev to re-skin on it might not be worth it, might be easier to do something totally custom.

Question:
does anyone have any ideas how this could be achieved?



via Chebli Mohamed

Wonder Plugin Carousel not showing up in my custom theme

I am having a problem getting the Wonder Plugin to show up on my cutom theme. This is the first plugin I have used where I have had any issues when I test it in twentyfifteen theme it works fine. I don't even get an error which makes the problem even more difficult to solve. I am not sure if I am missing some code to get my plugins to work.

Here is my functions.php:

    <?php


     /*



* @package WordPress
 * @subpackage Creativeforces
 * @since Creativeforces 1.0
 */ 

?>





<?php 

require_once('wp_bootstrap_navwalker.php');


    // Make theme available for translation
// Translations can be filed in the /languages/ directory
load_theme_textdomain( 'creativeforces', TEMPLATEPATH . '/languages' );

$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable($locale_file) )
    require_once($locale_file);

// Get the page number
function get_page_number() {
    if ( get_query_var('paged') ) {
        print ' | ' . __( 'Page ' , 'creativeforces') . get_query_var('paged');
    }
} // end get_page_number


function register_my_menus() {
  register_nav_menus(
    array(
       'primary' => __( 'Primary Menu', 'Creativeforces' ),
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' ),
      'sub_menu' => true
    )
  );
}

add_action( 'init', 'register_my_menus' );

   $defaults = array(
    'default-image'          => '',
    'width'                  => 0,
    'height'                 => 0,
    'flex-height'            => false,
    'flex-width'             => false,
    'uploads'                => false,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $defaults );



function themeslug_theme_customizer( $wp_customize ) {

  $wp_customize->add_section( 'themeslug_logo_section' , array(
    'title'       => __( 'Logo', 'themeslug' ),
    'priority'    => 30,
    'description' => 'Upload a logo to replace the default site name and description in the header',
) );
  $wp_customize->add_setting( 'themeslug_logo' );

  $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
    'label'    => __( 'Logo', 'themeslug' ),
    'section'  => 'themeslug_logo_section',
    'settings' => 'themeslug_logo',
) ) );
    // Fun code will go here
}
add_action( 'customize_register', 'themeslug_theme_customizer' );

 add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag


function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
  if ( isset( $args->sub_menu ) ) {
    $root_id = 0;

    // find the current menu item
    foreach ( $sorted_menu_items as $menu_item ) {
      if ( $menu_item->current ) {
        // set the root id based on whether the current menu item has a parent or not
        $root_id = ( $menu_item->menu_item_parent ) ? $menu_item->menu_item_parent : $menu_item->ID;
        break;
      }
    }

    // find the top level parent
    if ( ! isset( $args->direct_parent ) ) {
      $prev_root_id = $root_id;
      while ( $prev_root_id != 0 ) {
        foreach ( $sorted_menu_items as $menu_item ) {
          if ( $menu_item->ID == $prev_root_id ) {
            $prev_root_id = $menu_item->menu_item_parent;
            // don't set the root_id to 0 if we've reached the top of the menu
            if ( $prev_root_id != 0 ) $root_id = $menu_item->menu_item_parent;
            break;
          } 
        }
      }
    }
    $menu_item_parents = array();
    foreach ( $sorted_menu_items as $key => $item ) {
      // init menu_item_parents
      if ( $item->ID == $root_id ) $menu_item_parents[] = $item->ID;
      if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) {
        // part of sub-tree: keep!
        $menu_item_parents[] = $item->ID;
      } else if ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents ) ) ) {
        // not part of sub-tree: away with it!
        unset( $sorted_menu_items[$key] );
      }
    }

    return $sorted_menu_items;
  } else {
    return $sorted_menu_items;
  }
}

/**
 * Register our sidebars and widgetized areas.
 *
 */
function arphabet_widgets_init() {

  register_sidebar( array(
    'name'          => 'Primary Sidebar',
    'id'            => 'home_right_1',
    'before_widget' => '<div>',
    'after_widget'  => '</div>',
    'before_title'  => '<h2 class="rounded">',
    'after_title'   => '</h2>',
  ) );

}
add_action( 'widgets_init', 'arphabet_widgets_init' );





?>

here is my media.php I am adding the shortcode in:

<h3 class="text-center article-head">Check out the article that was written about us!</h3>
<div class="text-center">
   <img src="/wp-content/themes/creativeforces/images/la-parent.jpg" alt="" />
   </div>
   <h3 class="text-center"><a href="http://ift.tt/22Wscl6" target="_blank">Theater Improv Games are Fun Ideas For Kids</a></h3>
 <?php echo do_shortcode('[wonderplugin_carousel id="1"]'); ?>

I will be adding it to the Wordpress backend later. This is simply for testing purposes. Any help would be appreciated!



via Chebli Mohamed

Change Buddy-Verified plugin in BuddyPress to show Text as Title

I'm using BuddyPress to design my own social networking site and I've just added the BuddyVerified plugin and I just used a code that a forum user solved the problem of moving the verified badge from the profile pic (view forum here)

I'm happy with the result, however the verified text is placed at the bottom there instead of being used as a title. I want the verified badge to be used as a title, so when I hover over the badge it will display the verified text.

The PHP code I'm using for the Verified Badge is here



via Chebli Mohamed