jeudi 31 mars 2016

Make WordPress API faster by not loading theme and plugins

I would like to make requests to the WordPress API much faster. Right now, it is loading all the plugins, the child-theme and the theme and basically a query is taking half a second. Impossible to optimize this, the request doesn't do anything, it just returns a simple string as soon as it's called. Of course I could disable the plugins and the themes completely but the website requires them ;) Of course, the API part of the website doesn't require any of it, just an access to the database, basically the WordPress core. Is there anyway to do this?



via Chebli Mohamed

Fatal error: Call to undefined function mb_strtolower(): enable mbstring on linux EC2

I have installed the mbstring through sudo yum install php-mbstringon my linux EC2 instance with php 5.6.17. How can I enable it?



via Chebli Mohamed

Ajaxurl return 0

Im making a wordpress plugin which allows the admin delete a particular row in the database by clicking a button

<td>
    <img src="/DeleteRed.png" onclick="deleteRow(<?php echo $rowa->id?>)"><br>
</td>

Initially I was calling ajax like this

function deleteRow(val) {
    var url = "id="+val;
    alert (url);
    $.ajax( 
    {
        type:'GET',
        url:"../wp-content/plugins/salah-world/delete.php",
        data:url,
        success:function(data) {    
            console.log(data);
        }
     });
}

and using this PHP code

<?php
    $id=$_GET["id"];
    define('WP_USE_THEMES', false); 
    require_once( dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php');
    echo $id."ID";
    global $wpdb;

    $table_name = $wpdb->prefix . 'iqamahTimes';
    $wpdb->delete( $wpdb->prefix . 'iqamahTimes' , array( 'id' => $id ) );
?>

Which was working fine, returning the id as well as deleting it from the database. But when I submitted my plugin Wordpress said calling wp-load.php is big no no. Which I understand why.

I then try using ajaxurl and came up with this for the ajax

function deleteRow(val) {
        var url = val;
        alert (url);
        $.ajax(
        {
            url:ajaxurl,
            data: {
                'action':'exampleajaxrequest',
                'id'    : url
            },
            success:function(data)
            {    
                console.log(data);
                    //location.reload(true);
            }
        });

}

And the php is as followed

function exampleajaxrequest() {
    $id = $_REQUEST['id'];
    echo($id."id");
    global $wpdb;
    $table_name = $wpdb->prefix . 'iqamahTimes';
    $wpdb->delete( $wpdb->prefix . 'iqamahTimes' , array( 'id' => '5' ) );
    die();
}

I have put the add_action under the construct method as followed

public function __construct(){
    add_action( 'wp_ajax_exampleajaxrequest', 'exampleajaxrequest' );
    add_action( 'wp_ajax_nopriv_exampleajaxrequest', 'exampleajaxrequest' );

    add_action("admin_menu", array($this,"add_plugin_menu_fnbar"));
    add_action("admin_init", array($this,"register_dasettings"));

    add_action('admin_enqueue_scripts', array($this, 'register_admin_scripts'));
}

However when I run it I get this error
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'exampleajaxrequest' not found or invalid function name in /home/he/public_html/http://ift.tt/1MWhLGL on line 525
0

When I place the add_Action method somewhere else I just get 0 and nothing happens to the row.

NOTE: This is a backend script.



via Chebli Mohamed

How to remove one price in woocommerce variation variable price

Hi I just have some issue regarding variation prices when i add other than normal price it showing me two prices (two price on now and two price in was) what i need only one prices like simple product prices (one price on now and one price in was) example : http://ift.tt/25yRjyo



via Chebli Mohamed

How Can Specify the fields to Wordpress API v2

I'm using Wordpress REST API in my project and sending a GET request to http://myblog/wp-json/wp/v2/posts. It's working quite alright but I want to specify the fields but don't know how. Have looked at the documentation and still don't know how to go about it. For example, using the public API http://ift.tt/1RsgrAX returns only the specified fields. How do I this with the v2 API?



via Chebli Mohamed

call wp_enqueue_media on wordpress page

I am using a custom theme that when I access http://ift.tt/1Rsgpca , it gives the error that

upload-media.js?ver=1:3 Uncaught TypeError: Cannot read property 'editor' of undefined

it happends at the code _orig_send_attachment = wp.media.editor.send.attachment;

some google search (like here http://ift.tt/1qbGYGK ) suggests that "Above code snippet works on post edit page only, to make it work elsewhere you need to use wp_enqueue_media(); in your theme. Thanks to daviedR for correcting me on this."

Any idea how to do call wp_enqueue_media() on this page?



via Chebli Mohamed

Wordpress - customize plugin

I need to add html code to a plugin I downloaded but I was not able to understand how to extend it without overwriting the file itself.

There is any way to do that?
I do not want to change the core file because at the first update all my work will replaced.

Any idea? Any best practice?



via Chebli Mohamed

How to display product tab content onclick on button

I had displayed product tabs on category page with good look & feel but i got one problem like all tabs content displayed one by one in listing manner. So I want display that tab content only on onclick of that particular link otherwise active link content will show. I have tried following hooks & css for displaying product tabs on category page.

 .woocommerce-tabs ul.tabs{
list-style:none;
overflow:hidden;
position:relative;
margin:0 ;/*0 1.618em*/
padding:0;
}

 .woocommerce-tabs ul.tabs li {
background: #EFEFEF;
display:inline-block;
position:relative;
z-index:0;
margin:0;
}

 .woocommerce-tabs ul.tabs li.active{
    border-color:#78c8ce;
}
.woocommerce-tabs ul.tabs li a {
display:inline-block;
font-weight:600;
color:#606060;
text-decoration:none;
font-size:12px;
padding:10px 20px;
text-transform: uppercase;
}

.woocommerce-tabs ul.tabs li a:hover{
text-decoration:none;
color:#7a7a7a;
}
.noreviews a{color:#78c8ce;}
 .woocommerce-tabs ul.tabs li.active {
background-color:#78c8ce;
z-index:2;color:#FFF;
border-bottom-color:#78c8ce;
border-top-left-radius: 2px;
border-top-right-radius: 2px;

}

.woocommerce-tabs ul.tabs li.active a{
color:inherit;
text-shadow:inherit;
}

#rating_chzn{display: none;}
 .woocommerce-tabs ul.tabs:before{
position:absolute;
content:" ";
width:100%;
bottom:0;
left:0;
border-bottom:1px solid #EFEFEF;
z-index:1;
}

 .woocommerce-tabs .panel {
margin:0 0 2em;
padding:15px 0;
}

 .woocommerce-tabs .accordion-group.panel{
    padding:0;
    margin:0;
    display: block !important;
}
add_action('woocommerce_after_shop_loop_item', 'woocommerce_output_product_data_tabs', 20);

Please suggest any solution for that problem. also i have attached screen shot of that page. 1st tab content 3rd tab content etc.......



via Chebli Mohamed

Doesnt show thumbnail in plugin goods catalog wp

If there is a product attached to the cat, the cat image appear but when the category is empty, the image doesn't appear.



via Chebli Mohamed

mercredi 30 mars 2016

Show Bootstrap popup on leave the site r unload the page?

I can only alert using popit() function and return some text with default popup. I want to open bootstrap modal to doing some fun.



via Chebli Mohamed

WP survey plugin for tree structure questions

Is there any plugin available in wordpress for a survey in which each next question is based on the answer of previous question.

For Example:

Q1:Do you like burger? Answer: Yes Q2: Which burger?

If answer to Q1 is No then, Q2: Do you like pizza?

I need this kind of plugin, extension or something.



via Chebli Mohamed

wordpress schedule event not firing in set time

In wordpress I am creating a plugin where I am sending email to users. For that I am using wordpress cron job. So basically what it will do is just send emails to users in every hour. So my code looks like this

    public function __construct() {
        add_action('init', array( $this, 'send_emails_to_users') );  
      add_action('cliv_recurring_cron_job', array( $this, 'send_email') );
    }

    public function send_emails_to_users() {
        if(!wp_next_scheduled('cliv_recurring_cron_job')) {
          wp_schedule_event (time(), 'hourly', 'cliv_recurring_cron_job');
        }
    }

public function send_email() {
    //send email code goes here
}

Here everything looks good but it does not sends the email.

If I make my code like this

public function __construct() {
    add_action('head', array( $this, 'send_email') );  
}

Then it sends the email. But the problem is here it sends the email on every time the page loads or when user visits the site. That's why I want to use wp_schedule_event to make email in every hour. So can someone tell me how to resolve this issue. Any suggestion or help will be really appreciable.



via Chebli Mohamed

Blank wp-login.php page after entering credintials

Today I went to login into my wordpress admin but I am getting a blank page after entering in my login details (wp-login.php is a blank white page).

So far I have:

  1. Disabled all plugins through phpmyadmin (nothing changes)
  2. Disabled the active theme (Colormag) and set the default theme to twentysixteen (doesnt fix anything)
  3. I enabled debugging in the wp-config.php (doesn't give me an error message)
  4. the error_log file isnt giving me anything either

I am pretty much at my whits end to say the least. I have been using wordpress themes for nearly 6 years and never had anything like this happen.

So my main question is (besides some person on hear knowing what exactly is wrong) how can I get a debug/trace log showing me where the issue is happening? The main site itself is functioning perfectly, it just kinks up at the login page.

Thanks in advance!



via Chebli Mohamed

Force execute Woocommerce main query with pre_get_post

I'm trying to build an widget with filters the main woocommerce query to display specific products. I'm looking for a way of updating the query and re executing with no luck . The query from the archive-product.php

<?php if ( have_posts() ) : do_action( 'woocommerce_before_shop_loop' ); ?><?php endif; ?>
<?php do_action( 'woocommerce_archive_description' ); ?>

    <?php if ( have_posts() ) : ?>

        <?php woocommerce_product_loop_start(); ?>
            <?php woocommerce_product_subcategories(); ?>

            <?php while ( have_posts() ) : the_post(); ?>
                <?php woocommerce_get_template_part( 'content', 'product' ); ?>
            <?php endwhile; // end of the loop. ?>

        <?php woocommerce_product_loop_end(); ?>

        <?php
            /**
             * woocommerce_after_shop_loop hook
             *
             * @hooked woocommerce_pagination - 10
             */
            do_action( 'woocommerce_after_shop_loop' );
        ?>

I want to add a hook like

 add_action( 'woocommerce_product_query', 'so_27971630_product_query' );

function so_27971630_product_query( $q ){
    $meta_query = $q->get( 'meta_query' );
    $meta_query[] = array(
        'key' => 'custom_acf_key',
        'value' => 'custom_acf_value',
        'compare' => '='
        );

    $q->set( 'meta_query', $meta_query );
}

and re execute the query displaying the results in a div with ajax. I've done the ajax part and i'm stuck in the way of re executing the query



via Chebli Mohamed

wrap visual composer element(s) in a shortcode

I have some content created with visual composer and I want to wrap some of it in a shortcode like visual composer elements [is_mobile]visual composer elements wrapped in shortcode[/is_mobile] other visual composer elements

please how can it be done? thanks



via Chebli Mohamed

php concatenation - inserting value as class in html

I am trying to adapt a line of php code in a while loop, but something I do breaks how it is written to the html. When I query the datasbase for the value of my_product and insert it between the div-tags everything works, like so:

while ( $the_query->have_posts() ) {
        $the_query->the_post();
        echo '<div>' . the_field('my_product') . '</div>';
}

But when I try to query for my_colour and insert the value as a class inside the first div-tag, the value of my_colour is written to the html before the div-tags:

while ( $the_query->have_posts() ) {
        $the_query->the_post();
        echo '<div class="' . the_field('my_colour') . '"></div>';
}

What am I doing wrong here? (If you are wondering about the_field()it is a function belonging to teh plugin Advanced Custom Fields in Wordpress)



via Chebli Mohamed

Post URL Not Display In Google Search Results

I Am Using Wordpress Yoast Plugin

Hindimesupport Is My Blog Url. I Am Submited My Blog In Webmaster Tools. And No Any Error I Have Checked My Site In Google Like Site:http://ift.tt/1omlZRz But My Post Url Does not Disply In Google Search Results. Only Site Name/Category Are Disply. Can Any One Tell Me How Can I Do To Disply My Post Url In Search Results...

Thanks



via Chebli Mohamed

Wordpress Rest API

Is it possible to access pluggin's data from WordPress database with some Rest API. I saw WP REST API but it doesn't give access to pluggin's data.

More specifically I use LearnDash pluggin and I want to access courses infos but they doesn't provide any API to access it.

Thanks



via Chebli Mohamed

Adding a complex html / css / js element to a single Wordpress page

I've created a website (blog) using a theme; the website needs a page with a unit converter so I've gone ahead and created one using html, css and vanilla JS on Codepen. http://ift.tt/1MB9vRw

Codepen above ^^^

I also have the wordpress page for the converter setup here: http://ift.tt/1PFpIzP

I'm having trouble finding a way to get the converter 'onto' the wordpress page. I've tried adding it to the edit page text area, and also the 'additional code' section. The html elements are displayed, but the styling is completely wrong.

Do I need to create it as a separate entity like a plugin or a widget and then add it into the page? Or perhaps there's a particular file location on the server a I need to place my separate js and css?



via Chebli Mohamed

Woocommerce overridden not work after user logged in

i'm copy the folder plugin/woocommerce/template to theme/mytheme/woocommerceand design new template

the template work fine but when the user or admin logged in , the overridden not work and template return to plugin/woocommerce/template and show default template

So how to solve the problem?

I use woocommerce 2.5.5



via Chebli Mohamed

PHP Logic - Always Fails When Generate Different Output For Same Flag Status

I am making a custom payment wordpress plugin for my local bank (BCA Sakuku) and have problem when generate different output for same flag status always got "00" just for success case but got failed for other three cases such as "Invalid TransactionID" case, "Invalid Signature" case, & "Double Payment" case. For further detail please check out this link.

Here my result.php

<?php
    //catch from gateway
    $_POST = json_decode(file_get_contents("php://input"), 1);


    if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
        if( isset( $_POST['MerchantID'] ) AND isset( $_POST['TransactionID'] ) AND isset( $_POST['TransactionReffID'] ) AND isset( $_POST['Signature'] ) ){


            //VALIDATE MERCHANT ID 
            if( $_POST['MerchantID'] ==  $_POST['MerchantID']  ){

                $orders = $_POST['TransactionID']; 
                if( $orders AND $_POST['TransactionID']  ){

                    if( $orders  ==  $_POST['TransactionID'] ){

                        $sakukuOrder = $_POST['TransactionID']; 
                        if( $sakukuOrder ){
                                                        $str  =  $_SESSION["AccTok"].$_SESSION["TransID"].$_SESSION["AMOUT"].$_SESSION["PayID"];

                            $validate = strtoupper( hash('sha256', $str) );

                            if( $_POST['Signature'] ==  $_POST['Signature']){

                                //Only passed for "success" case  

                                generateOutput( 0, "00" );

                            }else{
                                generateOutput( 1, "01" );
                            }

                        }else{

                            generateOutput( 1, "01" );
                        }
                    }else{
                        generateOutput( 1, "01" );
                    }           
                }
                }else{
                    generateOutput( 1, "01" );
                }
            }else{
                generateOutput( 1, "01" );
            }
        }

 function generateOutput( $rs, $status ){

    $reason = array(
        "Indonesian" => array("Sukses","Transaksi tidak dapat diproses.","Transaksi sudah dibayar."),
        "English" => array("Success","Transaction cannot be processed.","Transaction has been paid."),
    );

    $output = array(
            "MerchantID" => ( !isset( $_POST['MerchantID'] ) ) ? '' : $_POST['MerchantID'],
            "TransactionID" => ( !isset( $_POST['TransactionID'] ) ) ? '' : $_POST['TransactionID'],
            "FlagStatus" => "01",
            "ReasonStatus" => array( "Indonesian" => "", "English" => "" )
        );

    $output['FlagStatus'] = $status;
    $output['ReasonStatus']['Indonesian'] = $reason['Indonesian'][ $rs ];
    $output['ReasonStatus']['English'] = $reason['English'][ $rs ];
    echo json_encode($output);      
}


?> 

So how I can figure out to generate different flag status output such as "00" for "success" case and "01" for "Invalid TransactionID" case, "Invalid Signature" case, & "Double Payment" case after payment completed?

For reproduce please checkout my demo or you can try buy one product on my development website with BCA Sakuku as payment option.



via Chebli Mohamed

Google XML-Sitemap: WP HTTP API Web Request failed: connect() timed out?

I did a lot of search, but error remains, when I run XML-Sitemap plugin in wordpress, I got this:

Ping Test

Trying to ping: http://ift.tt/1pK6sfl. The sections below should give you an idea whats going on.

Errors, Warnings, Notices:

WP_DEBUG was set to false somewhere before. You might not see all debug information until you remove this declaration! Notice: WP HTTP API Web Request failed: connect() timed out! in /var/www/html/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 2052 Result (text only):

Result (HTML):

How to solve this problem, any effort will be appreciated.

Version: Google XML-Sitemap 4.0.8, WordPress 4.3.3



via Chebli Mohamed

How to remove prefix="" from tag?

How can i remove prefix= attribute from this <html amp lang="en-US" prefix="og: http://mop.me/ns#" class="no-js"> by using hook. This is coming from Yoast SEO plugin.



via Chebli Mohamed

mardi 29 mars 2016

What eCommerce engine should i use?

Hi everybody how are you?

I turn to you for wisdom , and some good data.

I need to make an ecommerce site , with login, cart , catalog, shipments, checkout, etc. I will use some engine like PrestaShop, Abantecart, Litecart, or wordpress with some plugins. (I can code a little, but The thing is that i don't want code a new site from the biggining) Until there is a common eCommerce site. Any engine will works fine.

Here the tricky part : I need each user to have a "wallet " , which can charge money. and then make purchases from the money in your wallet.

users will not be able to buy things with paypal or credit card . only they are able to buy with the money from your wallet.

Today I spent the whole day searching the Internet for ecommerce engine , but found none that generates the user a wallet with credit balance

then the question is :

What engine do you recommend having these characteristics? (Or an engine that we can install a plugin with these features , but in that case , what plugin? )

from now, thank you very much to all!



via Chebli Mohamed

WordPress plugin to import Google calendar events to WordPress

I am searching for a plugin to import my Google Calendar events to my WordPress site database and display it in my posts.

Thank you



via Chebli Mohamed

WordPress Plugin is upload very slow

I have developed a plugin which has features of importing products from different online stores.

Now the total size of plugin is 4.4 MB which is creating issue for clients because its taking a huge time to upload. what is the good way of compressing the plugin to make it small? or any method of making it to upload fast.



via Chebli Mohamed

Wyswyg not working with qTranslate

I'm using ACF and ACF qTranslate on my multilanguage website (us / pt) and I'm having an issue at Wyswyg custom field. The content is not changing when I switch the language buttons at admin panel. However it works fine if I set it as an simple text field.

WordPress: 4.4.2

Advanced Custom Fields: 4.4.5

qTranslate-x: 3.4.6.4

Advanced Custom Fields: qTranslate: 1.7.9

Thanks for help!



via Chebli Mohamed

How to restore the html content after page reload?

I have the HTML content like the below:

<ul class="wpProQuiz_questionList" data-type="single" data-question_id="114">
    <li class="wpProQuiz_questionListItem" data-remember&gt;="" data-pos="0">
        <span style="display:none;">1. </span>
        <label>
            <input class="wpProQuiz_questionInput" type="radio" value="1" name="question_49_114">
            option 1
        </label>
    </li>
    <li class="wpProQuiz_questionListItem" data-remember&gt;="" data-pos="1">
        <label>
            <input class="wpProQuiz_questionInput" type="radio" value="2" name="question_49_114">
            option 2
        </label>
    </li>
    <li class="wpProQuiz_questionListItem" data-remember&gt;="" data-pos="2">
        <label>
            <input class="wpProQuiz_questionInput" type="radio" value="3" name="question_49_114">
            option 3
        </label>
    </li>
    <li class="wpProQuiz_questionListItem" data-remember&gt;="" data-pos="3">

I also have a next button which on clicking goes to the next li element and hides the previous one. Inside the li tag we have many options to select. I want to store all selected options and restore it after page reload and continue from where it was left.



via Chebli Mohamed

How to change database timezone from UTC to local in wordpress

I'm using a custom plugin in wordpress. All date and time are stored in database as UTC. I saw in posts table, there're 2 columns for UTC and local timezone (post_date, post_date_gtm), but in this plugin table, there's only 1 column to store the created date as UTC.

Currently, I'm using sql query and $wpdb to show the data between "start date" and "end date". Please help me to show them in local timezone (That is setted in general setting) instead of UTC!

Thanks and sorry about my English.



via Chebli Mohamed

Hide wp-login.php as log-in and redirect it to a custom login page

I'm trying to hide the wp-login.php on my site so I installed the plugin Rename wp-login.php, I renamed it as log-in. Now I want to redirect it to my custom login page so the default login form of wordpress is totally hidden. Is there a way to accomplish this? I have already tried a redirection plugin and the code below however it only supports the wp-login.php and not my new login url:

function redirect_login_page(){

// Store for checking if this page equals wp-login.php
$page_viewed = basename( $_SERVER['REQUEST_URI'] );

// permalink to the custom login page
$login_page  = get_permalink( '10' );

if( $page_viewed == "wp-login.php" ) {
    wp_redirect( $login_page );
    exit();
}
}

Is there a way to do this without actually altering the wordpress base files?



via Chebli Mohamed

Yoast SEO | How to create custom variables

Was just wondering if there is a way to create a custom variable so that I can add my custom variable created in the Meta title of the page.

Yoast SEO has a list of variables predefined here.

It would be great if I could create a variable of my own. Is there any way to get this?

Thanks in advance!



via Chebli Mohamed

Can you customize the DWQA search engine?

We would like to install the DWQA plugin, but only want questions to be generated based on keyword density (i.e user votes should not effect Question search engine only keyword relevancy....is this possible?

Regards



via Chebli Mohamed

lundi 28 mars 2016

How to call a java script on deactivation of wordpress plugin

I want to call a js file which have a ready function to call my api. My Code is..

<?php
.
. // rest all code.................................
.
.

/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'Pushbiz_remove' );

function Pushbiz_remove() {
/* Deletes the database field */

delete_option('PushBIZ_firstCreation');
delete_option('VarPushBIZapikey');
delete_option('PushBIZRegUrl');

wp_register_script( 'DeactivationJS', plugins_url( '/admin/js/deactivation.js', __FILE__ ));
wp_enqueue_script( 'DeactivationJS' );

}
?>

I am unable to call deactivation.js on on the deactivation of plugin. How can i call this java script on the event of deactivation.



via Chebli Mohamed

How to reload the data and ajax request from previous session on page reload?

I am using wp pro quiz plugin for taking the quiz. I want to know that how can I reload the previous question and answer on page reload or how can I save all the requests and restore it where it was before on page reload so that the quiz continues.



via Chebli Mohamed

Bind/ Merge all rev sliders into single slider worpdress?

I am using rev Slider plugin in WordPress theme. I have different role in a wordpress. Each user of different roles create the slider from admin panel of WordPress. Now the problem is to show all the sliders created by different user into a single slider.In front side, there will be a single slider where all slides will be rotated. All the sliders created by different user will be merged as a single slider. How to implement this? Please help me out to solve this requirement.



via Chebli Mohamed

How to fix minify problems in wordpress' css and js files?

When I try do minify the files using a cache plugin, it minfies some but the others are not minified and they are not linked on my website. When I take them off in the plugin options, they are linked back. Thus, breaking website's js and css. Can anyone help me? I tried to use another plugin but the problem remains.



via Chebli Mohamed

WP - Polylang : How to apply 'direction' on a specific div?

I am currently using Polylang plugin in wordpress.

The problem is, it applies the direction ( ltr / rtl ) in the page template (<article></article>), however, I was force to use (direction: ltr;) on the first child of some pages.

So the previous direction used by the Polylang isn't being applied at child elements that contain text.

Is there any way I can indicate on which <div> do the Polylang should apply its changes and/or styling ?



via Chebli Mohamed

Intelligent modal with Facebok Like box

I have one thing to make intelligent modal window with facebook like box. Intelligence is in not disturbing first time visitor and all visitors that has liked my FB page. Step by step logic is:

  1. Check cookie, if visitor is here for first time, create cookie with visit time and do nothing.
  2. If visitor returned to site after minimum 24 hours, check if logged in user has liked my FB page. If yes, do nothing.
  3. If returned visitor does not liked my FB page in past, dim browser and display modal (popup) window with facebook like box.
  4. If visitor close modal window without liking FB page, set cookie to do not disturb him anymore.

Sorry for my english. I'm dummy programmer, If you can help me to do this in PHP (for Wordpress as plugin), or if you thing that same plugin is exist, please send me link and I buy this plugin.

Thank you.



via Chebli Mohamed

WORDPRESS: get_adjacent_post not working after WPML installation

I used the command $adjacent_post_previous = get_adjacent_post(false,'',true) ; to get the next post id and the command $adjacent_post_next = get_adjacent_post(false,'',false) ; to get the previous post id, both for custom post type portfolio, and they worked fine. After I installed the wpml plugin, the first command doesn't work for the translated website, and the second command doesn't work for the initial website. Commands get_next_post and get_previous_post don't word either, but they also didn't work before. I need this to display the next and previous post thumbnail, and all the relative commands need the post id to work. Is there any other way to get the next and previous post id?



via Chebli Mohamed

Remove button of upload spreadsheet is not working in ARForm wordpress plugin

Remove button of upload spreadsheet is not working in ARForm wordpress plugin. I have installed ARForm wordpress plugin to build a form.All is working properly but "Remove" button of upload spreadsheet is not working.



via Chebli Mohamed

I Can't find this margin-bottom code

Here is my website : http://ift.tt/22TuJyn

I want to change (margin-bottom:100px;) in (#header-wrapper-sticky-wrapper) but i cant find this exact location in folder => file. Please help me , how can I change this margin.

Thanks in advanced.
For details please view this Image



via Chebli Mohamed

Add meta box to rev slider wordpress?

I want to add a text box in a rev slider plugin where current user id will be stored as a value. I want to fetch that value in one of the slider file. how to perform this task? please help



via Chebli Mohamed

display product tabs on product category pages in woo-commerce.?

I want to display product tabs on category page in woocommerce. I have tried the following solution but didn't get any proper solution.

add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 60 );

so please help Me.



via Chebli Mohamed

dimanche 27 mars 2016

wp-login send data to JS

I know that in order to send data from PHP to JS, you have to enqueue the JS and the localize it in order to send the data, however, in the login page (wp-login.php), using the login_enqueue_scripts, works correctly, but when using wp_localize_script, seems not to send the data.

What is the correct approach here?



via Chebli Mohamed

How to provide vehicle tracking feature to WordPress?

Greeting to all

I need some help. Is there any way to provide real time tracking of vehicle(GPS enabled) in WordPress site? Actually i am building a website in which user can get their logistic information.



via Chebli Mohamed

samedi 26 mars 2016

How can i solve this issue "show product quantity in stock respect to size" in WooCommerce

i have install woocommerce plugin and wanted to show product quantity with respect to size in this way on product page like large:15 and small:13 in stock wordpress version is 4.4.2 so please guide me how can i do this



via Chebli Mohamed

How to programmatically remove the kitchen sink button in Wordpress

I know there are a couple plugins out there. I'd rather hard code it into my theme. I can't find any hooks, etc for how to do this.

enter image description here



via Chebli Mohamed

Multiple Instances of WP Job Manager in one Wordpress installation

I am using a wordpress theme called listify. WP Job Manager is a required plugin. On my website, I need two kinds of listings. One listing for the employers [employers listing] and another one for the vacancies posted by those employers [vacancy listing]. The WP Job Manager plugin doesn't seem to support multiple listings in one installation. If you can write a separate custom page (one not provided with the theme) for the vacancies, how would you get to define those vacancies under an employer. What other plugin alternatives do I have?



via Chebli Mohamed

Woocommerce add images from folder to featured product image

  <ul class="products">
      <?php
        $args = array(
          'post_type' => 'product',
          'posts_per_page' => 100
          );
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {
          while ( $loop->have_posts() ) : $loop->the_post();
          global $product;
          // echo '<pre>';
          // print_r($product->id);
          // echo '</pre>';
          ?>
          <img src="<?php echo bloginfo('template_url'); ?>/images/<?php echo $product->id; ?>_1.jpg" alt="zzz" />
          <?php
          //  wc_get_template_part( 'content', 'product' );
          endwhile;
        } else {
          echo __( 'No products found' );
        }
        wp_reset_postdata();
      ?>
      </ul><!--/.products-->

Hi, I have a old folder with product images, there are about 200 of them, each image has the ID the same as the product, and the category next to it, exemple 301_1.jpg, and the product ID is 301. I need to add the images from the folder to the products more exactly featured image. How can I do that ?input the images into a database ?



via Chebli Mohamed

How to access options.php on form submit when the user role is contributor?

I creating one wordpress plugin where I want to update options.

I used below code

<form method="post" action="options.php">

But When I submit this form I got error

 Cheatin’ uh?

Here I have logged in as contributor.So How to submit this form when user is contributor? I want to access only this file when user is contributor.



via Chebli Mohamed

How to update options table fields in wordpress when user is not admin?

I am creating wordpress plugin where I want to update options table fields on form submit but user role is contributor.



via Chebli Mohamed

Adding a Category-wise post slider in wordpress theme

I installed wordpress Genesis theme for my website. Currently, the home page lists down all the recent posts together from different categories.

I want to remove showing all posts haphazardly and install a category wise post slider in my homepage where under each category segmented posts will be shown which the users can scroll horizontally.

I found out this plugin but don't know how to use it in my theme. It would be helpful if someone knows a similar plugin also.

Here is my genesis theme home.php file content

<?php

 /* I added this code for that plugin */
echo do_shortcode( '[wpsc_categorywise_slides]' );

//* Add Genesis grid loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'eleven40_grid_loop_helper' );
function eleven40_grid_loop_helper() {

    if ( function_exists( 'genesis_grid_loop' ) ) {
        genesis_grid_loop( array(
            'features'              => 0,
            'feature_image_size'    => 0,
            'feature_image_class'   => 'alignleft post-image',
            'feature_content_limit' => 0,
            'grid_image_size'       => 'grid-featured',
            'grid_image_class'      => 'grid-featured',
            'grid_content_limit'    => 250,
            'more'                  => __( '[Continue reading]', 'eleven40' ),
        ) );
    } else {
        genesis_standard_loop();
    }

}

//* Run the Genesis loop


genesis();



via Chebli Mohamed

Wordpress plugin error with RevSilder?

i have a wordpress website using Revolution Slider plugin, i got an error when i move this website to aws-ec2.

My Revolution Slider manage page show nothing, so i open debug mode and got below error message.

page is:wp-admin/admin.php?page=revslider

error msg:

Fatal error: Uncaught exception 'Exception' with message 'fetch - <b></b><br>---<br>
Query: select * from wp_revslider_css' in /var/www/html/wp-content/plugins/revslider/inc_php/framework/functions.class.php:7
Stack trace:
    #0 /var/www/html/wp-content/plugins/revslider/inc_php/framework/db.class.php(22): UniteFunctionsRev::throwError('fetch - <b></b>...', -1)
    #1 /var/www/html/wp-content/plugins/revslider/inc_php/framework/db.class.php(36): UniteDBRev->throwError('fetch - <b></b>...')
    #2 /var/www/html/wp-content/plugins/revslider/inc_php/framework/db.class.php(127): UniteDBRev->checkForErrors('fetch')
    #3 /var/www/html/wp-content/plugins/revslider/revslider_admin.php(241): UniteDBRev->fetch('wp_revslider_cs...')
    #4 [internal function]: RevSliderAdmin->onAddScripts('toplevel_page_r...')
    #5 /var/www/html/wp-includes/plugin.php(470): call_user_func_array(Array, Array)
    #6 /var/www/html/wp-admin/admin-header.php(80): do_action('admin_enqueue_s...', 'toplevel_page_r...')
    #7 /var/www/html/wp-admin/admin.php(202): require_once('/var in /var/www/html/wp-content/plugins/revslider/inc_php/framework/functions.class.php on line 7


enter image description here

Can you please tell me how can i fix this error?

Thanks a lot.



via Chebli Mohamed

vendredi 25 mars 2016

product with multiple values

I want to create a product with multiple values, but without a selling option (like a add to cart option). I'm creating a online catalogue, but i have one product with multiple options and thus multiple prices. Is there any possible way to create something like this in Wordpress?

This is what i intend to create: http://ift.tt/1RDWitB Here you can select 4 options and then you get your price for your selection.

Thanks in advance.



via Chebli Mohamed

A map plugin for wordpress with some constraints

I am in need of a wordpress plugin that can do the following job. I am thinking about a startup for helping people and I would be grateful if someone can help.

The plugin should allow a user to give his location and it should pin the location of the user in the map. Any other user can see how many users in his area have given their location to the map and the other user can see the pinned users and their contact infos.

This will be a startup where people can post their problems and other people can see the map of their own area and see who needs help and then they can help their neighbours etc.

Best Regards.



via Chebli Mohamed

how to integrate billdesk payment gateway in wordpress

I have my wordpress site and i need to integrate billdesk payment gateway in it. If there is nothing directly available for wordpress then is there any api so I can start with it to integrate it in my site using core php.



via Chebli Mohamed

Translating points earned in a Q&A forum in to credits in a digital wallet

I have created a e-commerce website in wordpress and i intend to create a Question and Answer discussion forum as an addition to it.

The main functionality is to translate the upvotes/likes in to credits with which the users can buy stuff in the ecommerce website. Both the ecommerce site and forum must have single login.

What is the best way to achieve this? Which plugins I should use.

I am a newbie, so nevermind if this question is too amateurish Thanks



via Chebli Mohamed

Amazon Cloudfron with W3 Total Cache plugin

I am using Amazon Cloudfront CDN with S3 as a Origin [cdn.mycompany.com as a CNAME) in Wordpress W3 Total Cache Plugin. I am running wordpress instance in Amazon EC2 instance and all our CSS, JS, Image files are uploaded to S3 storage and now the initial deployment is working fine. But I want to know, what is the best practice in case of further incremental changes.

As for as I now, if I have to add a new page / modify existing page with some style changes, I have to do the changes in my Wordpress site (which will take place in wordpress db) and I have to update the CSS/JS files to S3 storage and then run Invalidation for the files to reflect the changes. But I believe until then, the page wont show the latest content as the invalidation process takes around 10 to 15 min of time. That means, during the invalidation period, wordpress db have latest page content and cloudfront edge have the old content.

Can any one let us know, how does other handle this and what is the process of updating existing files in Cloudfront without affect my website. Or let me know, if I misunderstood anything.

Thanks in Advance.



via Chebli Mohamed

jeudi 24 mars 2016

Google adsense plugin configuration issue

I installed the official google Adsense plugin to my Wordpress blog.

After I made the ads placement and going to save the settings I got this error:

Sorry we were unable to save your configuration. Your site took too long to respond. Please try again.

I'm trying since yesterday but there were no change just getting the error..

My Adsense account already approved and the ads was appeared on my site but on different theme.

Your support is highly valued



via Chebli Mohamed

Add a select YES / NO to a form and display the result in product WooCommerce

Add a select YES / NO to a form and display the result in product WooCommerce.

I use Wordpress and WooCommerce

I have an online form that allows you to add products.

In this form, I want to add the choice YES or NO to indicate whether the product is exchangeable.

  • If "NO" is displayed on the product page: "Exchangeable product: NO   This product is not exchangeable "

  • If "YES" is displayed on the product page:   "Exchangeable product: YES    This product is exchangeable, click here to make an offer "(click here is a clickable link)

Here is my code which does not work well:

---- in my product-edit.php template ----

<?php 
WCVendors_Pro_Form_Helper::select( 
array( 
    'post_id'           => $object_id, 
    'id'                => 'wcv_custom_product_echangeable', 
    'label'             => __( 'Produit échangeable', 'wcvendors-pro' ), 
    'wrapper_start'     => '<div class="all-100">',
    'wrapper_end'       => '</div>', 
    'options'           => array(
        'non'       => __( 'non', 'wcvendors-pro' ),
        'oui'       => _x( 'oui', 'wcvendors-pro' ),
        ) 
    ) 
); 
?>

//This code will display the vales on the single product page.  Add this code to my themes functions.php file

add_action('woocommerce_product_meta_start', 'wcv_echangeable', 2);
function wcv_echangeable() {
$output = get_post_meta( get_the_ID(),     'wcv_custom_product_echangeable', true );
echo 'Produit échangeable: ' . $output . '<br>';

$pos = strpos( $output, 'oui' );
if ( $pos === false ) {
    echo 'Ce produit est échangeable,<a href="#">Cliquez ici </a> pour faire une offre <br><br>';
} else {
    echo 'Ce produit n\'est pas échangeable.<br><br>';
 }
}

Can anyone help me? Thank you in advance



via Chebli Mohamed

Woocommerce Add Product with Link, redirect and Refresh Cart Page

I'm trying to setup a simple way of adding a Woocommerce product to the shopping cart by using an html a tag and after clicking on it redirect to the shopping cart page.

So far I can add the product to the cart but it only appears in the Cart if I force refresh the page. Basically the redirectToCart function is not refreshing the page.

            echo '<a class="btn btn-default" id="buy'.$image->ID.'" href="#">Order This!</a>
            <script>    
                $("#buy'.$image->ID.'").click(function(e) {
                  e.preventDefault();
                  addToCart(37);
                  redirectToCart("?page_id=27")
                  return false;
                 });    

                function addToCart(p_id) {
                  $.get("?post_type=product&add-to-cart=" + p_id, function() {  
                     // call back
                  });
                }

                function redirectToCart(cartPage) {
                    window.location.replace(cartPage);
                }
            </script>';

Can anyone help me out with this?



via Chebli Mohamed

Overriding a class's method not working in PHP

It has been more than a week that I have been fighting with this issue and haven't got a fix around it. I'm trying to extend a class and overwrite some methods of it, so that I can display my own messages over there:

The parent class:

class Order {
 public function details( $echo = true ) {

    $cart = $this->get_cart();

    $currency = $this->get_meta( 'mp_payment_info->currency', '' );
    $cart     = $this->get_meta( 'mp_cart_items' );
    if ( ! $cart ) {
        $cart = $this->get_meta( 'mp_cart_info' );
    }
    /**
     * Filter the confirmation text
     *
     * @since 3.0
     *
     * @param string The current confirmation text.
     * @param MP_Order The order object.
     */
    $confirmation_text = apply_filters( 'mp_order/confirmation_text', '', $this );
    $confirmation_text = apply_filters( 'mp_order/confirmation_text/' . $this->get_meta( 'mp_payment_info->gateway_plugin_name' ), $confirmation_text, $this );

    $cart_contents = '';
    ob_start();
    ?>
    <?php if ( is_array( $cart ) ): ?>
        <?php foreach ( $cart as $product_id => $items ): ?>
            <?php foreach ( $items as $item ): ?>
                <?php $product = new MP_Product( $product_id ); ?>
                <div class="mp_cart_item" id="mp-cart-item-104">
                    <div class="mp_cart_item_content mp_cart_item_content-thumb"><img
                            src="<?php echo $product->image_url( false ) ?>"
                            width="75" height="75" style="max-height: 75px;">
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div class="mp_cart_item_content mp_cart_item_content-title">
                        <h2 class="mp_cart_item_title">
                            <a href="<?php echo $item['url'] ?>"><?php echo $item['name'] ?></a>
                        </h2>
                        <?php
                        if ( $product->is_download() && mp_is_shop_page( 'order_status' ) ) {
                            echo '<a target="_blank" href="' . $product->download_url( get_query_var( 'mp_order_id' ), false ) . '">' . __( 'Download', 'mp' ) . '</a>';
                        }
                        ?>
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div class="mp_cart_item_content mp_cart_item_content-price"><!-- MP Product Price -->
                        <div class="mp_product_price" itemtype="http://schema.org/Offer" itemscope=""
                             itemprop="offers">
                                <span class="mp_product_price-normal"
                                      itemprop="price"><?php echo mp_format_currency( '', $item['price'] ) ?></span>
                        </div>
                        <!-- end mp_product_price -->
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div
                        class="mp_cart_item_content mp_cart_item_content-qty"><?php echo $item['quantity'] ?>
                    </div>
                    <!-- end mp_cart_item_content --></div><!-- end mp_cart_item -->
            <?php endforeach; ?>
        <?php endforeach; ?>
    <?php else: ?>
        <?php
        $cart->display( array(
            'echo'     => true,
            'view'     => 'order-status',
            'editable' => false,
        ) );
        ?>
    <?php endif; ?>
    <?php

    $cart_contents = ob_get_clean();

    $html = '
        <!-- MP Single Order Details -->
        <section id="mp-single-order-details" class="mp_orders">
            <div class="mp_order_details">
                <div class="mp_order">' .
            $this->header( false ) .
            '</div><!-- end mp_order -->' .
            $confirmation_text . '
                <div class="mp_order_cart">' .
            $cart_contents . '
                </div><!-- end mp_order_cart -->
                <div class="mp_order_address">' .
            $this->get_addresses() . '
                </div><!-- end mp_order_address -->
            </div><!-- end mp_order_details -->
        </section><!-- end mp-single-order-details -->';

    /**
     * Filter the order details
     *
     * @since 3.0
     *
     * @param string $html The current details.
     * @param MP_Order $this The current order object.
     */
    $html = apply_filters( 'mp_order/details', $html, $this );

    if ( $echo ) {
        echo $html;
    } else {
        return $html;
    }
    }
}

My class extending this:

 class My_Order extends Order {
   public function details( $echo = true ) {

    $cart = $this->get_cart();

    $currency = $this->get_meta( 'mp_payment_info->currency', '' );
    $cart     = $this->get_meta( 'mp_cart_items' );
    if ( ! $cart ) {
        $cart = $this->get_meta( 'mp_cart_info' );
    }
    /**
     * Filter the confirmation text
     *
     * @since 3.0
     *
     * @param string The current confirmation text.
     * @param MP_Order The order object.
     */
    $confirmation_text = apply_filters( 'mp_order/confirmation_text', '', $this );
    $confirmation_text = apply_filters( 'mp_order/confirmation_text/' . $this->get_meta( 'mp_payment_info->gateway_plugin_name' ), $confirmation_text, $this );

    $cart_contents = '';
    ob_start();
    ?>
    <?php if ( is_array( $cart ) ): ?>
        <?php foreach ( $cart as $product_id => $items ): ?>
            <?php foreach ( $items as $item ): ?>
                <?php $product = new MP_Product( $product_id ); ?>
                <div class="mp_cart_item" id="mp-cart-item-104">
                    <div class="mp_cart_item_content mp_cart_item_content-thumb"><img
                            src="<?php echo $product->image_url( false ) ?>"
                            width="75" height="75" style="max-height: 75px;">
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div class="mp_cart_item_content mp_cart_item_content-title">
                        <h2 class="mp_cart_item_title">
                            <a href="<?php echo $item['url'] ?>"><?php echo $item['name'] ?></a>
                        </h2>
                        <?php
                        if ( $product->is_download() && mp_is_shop_page( 'order_status' ) ) {
                            echo '<a target="_blank" href="' . $product->download_url( get_query_var( 'mp_order_id' ), false ) . '">' . __( 'Download', 'mp' ) . '</a>';
                        }
                        ?>
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div class="mp_cart_item_content mp_cart_item_content-price"><!-- MP Product Price -->
                        <div class="mp_product_price" itemtype="http://schema.org/Offer" itemscope=""
                             itemprop="offers">
                                <span class="mp_product_price-normal"
                                      itemprop="price"><?php echo mp_format_currency( '', $item['price'] ) ?></span>
                        </div>
                        <!-- end mp_product_price -->
                    </div>
                    <!-- end mp_cart_item_content -->
                    <div
                        class="mp_cart_item_content mp_cart_item_content-qty"><?php echo $item['quantity'] ?>
                    </div>
                    <!-- end mp_cart_item_content --></div><!-- end mp_cart_item -->
            <?php endforeach; ?>
        <?php endforeach; ?>
    <?php else: ?>
        <?php
        $cart->display( array(
            'echo'     => true,
            'view'     => 'order-status',
            'editable' => false,
        ) );
        ?>
    <?php endif; ?>
    <?php

    $cart_contents = ob_get_clean();

    $html = 'I JUST WANT TO REPLACE THIS';

    /**
     * Filter the order details
     *
     * @since 3.0
     *
     * @param string $html The current details.
     * @param MP_Order $this The current order object.
     */
    $html = apply_filters( 'mp_order/details', $html, $this );

    if ( $echo ) {
        echo $html;
    } else {
        return $html;
    }
}
}

Where the only thing I want to override is this: $html = 'I JUST WANT TO REPLACE THIS';

I have also tried overriding other methods of this class as well, but none of them works.

Thanks



via Chebli Mohamed

Recently viewed non cookie version

I've built a widget where I'm trying to display recently viewed recipes.

Inside my single-recipe page I've added this code:

update_post_meta( $post->ID, 'mp_last_viewed', current_time('mysql') );

Inside my widget, I use this

$params = array(
        'post_type'      => 'recipes',
        'posts_per_page' => $limit,
        'post_status'    => 'publish',
        'offset'         => '$offset,
        'orderby'        => 'meta_value',
        'order'          => 'DESC',
        'meta_key'       => 'mp_last_viewed',
        'post__not_in'   => 'array($post_id)',
     );

     $query_recipes = new WP_Query($params);

This displays a list of latest recipes that every visitor looked at.

Now I'd like to limit this list to the current visitor only, without using cookies. And if possible add an expiration date of 24h. Is this even possible and how? Or should I go for cookies instead? If I do, any links to tutorials?



via Chebli Mohamed

Display language switcher button shortcode of WPGlobus plugin - Wordpress

I am using WPGlobus plugin to make website multi-language. A widget is displaying in widget area but I want to add language switcher button manually. I search its short code to display language switcher flags. But not found any any shortcode. Any best way to display buttons manually by shortcode.



via Chebli Mohamed

image not showing in the desired place with plugin metabox

I have used a plugin (Meta box 4.8.3) to create custom meta box and get values in custom post. If custom meta box field is text then the function returns the value. If it is image then it do not show the images.

**Register custom meta-box **

    add_filter( 'rwmb_meta_boxes', 'your_prefix_meta_boxes' );
    function your_prefix_meta_boxes( $meta_boxes ) {
    $meta_boxes[] = array(
      'title'      => __( 'Image Gallery', 'textdomain' ),
      'post_types' => 'events',
      'fields'     => array(
        array(
            'name' => __( 'Image Upload', 'your-prefix' ),
            'id'   => "{$prefix}image",
            'type' => 'image'
        ),

       ),
     );
    return $meta_boxes;
    }

To get the images the code is this

   $meta = get_post_meta( get_the_ID(), '{$prefix}image', TRUE );
           var_dump($meta); 
           echo "HAHAHAHAHA";
               if($meta){
                   echo "HAHAHAHAHA<br>";
                foreach($meta as $image) {
                    echo "HAHAHAHAHA";
                    $res.='<li>'.$image.'</li>';
                }
            }
           ?>

How can i display the images which i uploaded through the dashboard.



via Chebli Mohamed

mercredi 23 mars 2016

Hooks Confussion: authenticate, wp_authenticate and wp_authenticate_user

Reading the Codex, these 3 hooks seems like do the same stuff, they could do the same stuff but in different stages, however is pretty confussing what differences are among them.

When does each one is applicable?



via Chebli Mohamed

Get data from database of Wordpress in Plugin

I am trying to get last inserted data from WP database but it shows nothings.

My code :

global $wpdb;
    $lastid = $wpdb->insert_id;
    $table = $wpdb->prefix."videos";
    $result = $wpdb->get_results("SELECT * FROM $table WHERE id = '$lastid'");
     foreach ( $result as $print )   {

  echo '<tr>';
  echo '<td>' . $print->video.'</td>';

  echo '</tr>';

}

Please advise.



via Chebli Mohamed

Widget retrieve same post_excerpt for different Post object

WP_Post Object
(
    [ID] => 73 
    [post_title] => Jane Doe
    [post_excerpt] => Junior Programmer
    [post_name] => jane-doe

)

WP_Post Object
(
    [ID] => 72
    [post_title] => Rob Gilbert
    [post_excerpt] => Trainee Programmer
    [post_name] => rob-gilbert
)

Those two objects are generating from a $posts = get_posts($args); Each of the post_title is showing as a select box option. But I also need to show post_excerpt. If I choose Jane Doe from select box it loads "Junior Programmer" as the value of post_excerpt.

But if I choose Julia Doe from options that is also showing "Junior Programmer" as the value of post_excerpt instead of showing "Programming Lead".

What did I do wrong? Why the same value is showing for different option? What is it that I am missing

enter image description here

Here is the backend code.

global $post;    
    $args = array(
            'type'                  => 'post',                              
            'orderby'               => 'name',
            'order'                 => 'ASC',                   
            'taxonomy'              => 'department',                    
            'posts_per_page'        => -1,
            'post_type'             => 'employee',
            'tax_query'             => array(
                                            array(
                                                'taxonomy' => 'department',
                                                'field' => 'slug',
                                                'terms' => 'programming',
                                                )
                                            ) 
                ); 
            $posts = get_posts( $args );
            ?>
            <p>
                <label for="<?php echo $this->get_field_id( 'employee' ); ?>">Employee:</label>
                <select class="widefat" 
                    name="<?php echo $this->get_field_name( 'employee' );?>"
                    id="<?php echo $this->get_field_id( 'employee' ); ?>">
                        <option value="" selected></option>
                <?php 
                        foreach ( $posts as $post ) :
                            setup_postdata( $post );                        
                 ?>
                <option value="<?php echo esc_attr( $post->post_title ); ?>"
            <?php selected($instance['employee'], $post->post_title); ?>>
            <?php echo esc_html( $post->post_title );?>
            <?php $excerpt = esc_html( $post->post_excerpt ); ?>                    
                </option>           
                <?php   endforeach; wp_reset_postdata(); ?>
                    </select>               
                <p> 
                <?php echo "<pre>"; print_r($excerpt); echo "</pre>"; ?>        



via Chebli Mohamed

Wordpress Product type

Im trying to sort out how to make custom product type with following options:

Im Creating item #B, on item #B i want it to adjust the warehouse amount on article #A because they are the same article but its a bulk pack.

Item #A = 1pcs Item #B = 20pcs of Item #A to a better price.

Can i multiply below with a custom field with the amount and then remove it from my other custom wield with the articlenr?

$the_product->stock_status

How can i manage to build this or does anybody know about this type of plugin, i have searched the web for a couple of days.



via Chebli Mohamed

what is the General Idea to download a file after fill up the wp contact form?

In my WordPress website I am using Contact Form 7 plugin to show a form to get information from the users.

Now, I want user must be fill up the form and after that they can download a file. Only after fill up the form a file link will be show to download.

so I want to know what is your idea to get it done in WordPress ?

I searched google and found 3 plugins to do the job but is there any other custom way in WordPress ?

Thank You.



via Chebli Mohamed

Woocommerce archive-product.php overwrite issues.

I'm trying to customize the archive-product page, and it works perfectly while I'm on my local server, but when I move it online, it's switches back to the default template. I'm trying to fix this for a week now, I've read all the other answers regarding this issue, but most of them are for an older version of woocommerce or the solution just doesn't work.

As a last refugee from madness, I've deleted all the archive-product.php file I can find, even the one in the woocommerce source folder, but nothing changed, I don't know where the site is getting the template from. The page have become self aware and I am going crazy because I have no idea what to do next.

Here is the difference between the page on local and online server



via Chebli Mohamed

building a wordpress api that calls multiple tables

TL;DR - How do I tie information together from different tables to create an API for a plugin.

To give a run down of what I am doing. We are building an app and a website for a clients gym, the app, for now, only pulls in blog posts, calendar activities, allows them to add the activities to their phone, and a description of the facility, while the website goes more in depth about the gym, the trainers, and any events going on. It was decided that we should use Wordpress for the admin panel for the website and the app, so they only need to do the work in one place.

For the app I am using WP REST API v2 to pull in the blog posts, which is the easy part. But the calendar has become extremely difficult. The theme we bought is Symetrio Gym and Fitness which comes with a calendar that we could use, and it almost matches what we were using in the app. So what we need to do is pull in the data that is entered into the calendar and use an API Call in the app to display the data.

So here is where things get complicated, the calendar uses multiple tables to pull in all it's data. For the Trainer, Classes, and Room it creates a custom post type, that just houses the name of the trainer, class, or room. But for the dates, and times, and the data that it references, it uses two separate tables, one called schedule_ap_multi that has the date, the reference id, and the id of the class, that is referenced in posts.

The next table is called schedule_ap_multi_fields, that has the start time, the end time, the id that references which row to use in schedule_ap_multi, the id of the room post, the id of the trainer, and a description of the activity, but these are all in their own row, the only thing really tying them together in the ID for schedule_ap_multi.

here are some images of how the two tables are set up.

schedule_api_multi

schedule_api_multi_fields

I started to build an API for the calendar, but I can't get any data from the tables, it seems I can only get data from Posts, and since the dates and start and end time are not posts, its difficult to get them. for the JSON object I am creating its structured like this:

 protected function make_data( $post, $data ) {

 global $wpdb;

 $classesID = $wpdb->get_results('SELECT ID FROM wp_wtr_schedule_ap_multi',ARRAY_A);
 $classes = $wpdb->get_results('SELECT * FROM wp_posts WHERE post_type = "classes"',OBJECT);

 $date = $wpdb->get_results('SELECT * FROM wp_wtr_schedule_ap_multi');
 $data[ $post->ID ] = array(
            'title'             => 'the title',
            'type'              => $post->post_type,
            'room'              => 'the room',
            'instructor'        => 'the instructor',
            'description'       => 'the description',
            'start_date'        => 'start date',
            'end_date'          => 'end date',
            'image'             => 'image',
            'style'             => 'style',
   };
  return $date;

when I do $post-> it only gets the post_type of posts, and it's been a challenge getting any other post_type that isn't a post, when I use any of the wpdb commands I get the query back, but in full, and only if I use it as one of the JSON objects, it won't return an array when I put it in

$data[ here ]=array()

What I am trying to do, to summarize, is tie all these objects together, to make one api call, hopefully, and fill in the calendar on the app side, to display the data I need for each activity created in WordPress. I am at a complete loss now to what I need to do, and no one else on my team has any experience with wordpress plugins or creating a custom API for wordpress.



via Chebli Mohamed

Edit .htaccess with Wordpress Plugin API?

I want to write a wordpress plugin that requires changing the .htaccess file. How do I do that in PHP. I have seen this done before with other plugins but, I can not figure out how it is done. Thanks!



via Chebli Mohamed

Does PayPal IPN require SSL certificate?

I'm using a plugin called PayPal IPN for wordpress. The plugin generates an IPN URL, however, when I try and enter this IPN in to PayPal I get the following error message:

"We're sorry. That URL won't work. Please enter an “https” URL."

This was the plugin generated URL:

http://ift.tt/1WI4BT8

I have entered other URLs before and have never seen this message, although the IPNs weren't sent properly. Does this mean that I have to get an SSL certificate for IPNs to be sent through? Thank you.



via Chebli Mohamed

Revolution Slider - remove shape behind text layer

I'm new to the Revolution slider and I am having an issue when adding a text/html layer on a slide I get this gray background shape behind my text, however I am not able to figure out on how to remove it.

Revolution Slider Problem Example

Thanks in advance!



via Chebli Mohamed

How to get tabs for products on product category pages in woocommerce

I want to display product tabs on category page in woocommerce. so please help Me.



via Chebli Mohamed

Wordpress portfolio plugin recommend

I need the following features

Content popup

Load more/pagination

Item custom links

Thanks for help!!



via Chebli Mohamed

Google Place Reviews - Submitting reviews

I am researching whether the following is possible and if so how I could go about achieving it.

We collect reviews for businesses from their customers and we’d like to post these reviews to Google places as part of the reviews they have on their.

I used google place reviews plugin to get this data but i have not dispaly data from that there is message like There are no reviews yet for this business. Be the first to review.

What can i do in this situations!!!!



via Chebli Mohamed

Need Advise for the best Fundraising Plugin

Hi I need advise what is the best plugin that make user ( not admin ) to be able to make their own campaign fundraising in WordPress ?

Thank You



via Chebli Mohamed

Contact form 7 upload not working with windows phone

I am currently using contactform 7 on my website. One form has an upload function for pictures. Where android and iphone open a window where you can choose either camera or file if you tap the upload button, windowsphone does nothing. Al other buttons/dropdowns etc work.

Is this contactform related or windowsphone or related to the personal settings of the user? I can't seem to find any topics about this on internet.

Any ideas? Thanks



via Chebli Mohamed

Wordpress Plugin to show Visitors Statistics on Dashboard and also via Email

I need a Wordpress Plugin to show Visitors Statistics on Dashboard and also via Email that will include :

Title of Visited Page URL No. of Visitors

Which Plugin is best to implement above feaure. I have tried WP-STATISTICS, WP-Stats and JetPack but I was unable to implement because I am using MS SQL Server DB not MySql



via Chebli Mohamed

mardi 22 mars 2016

Want to apply below slider

I want to apply below slider in my WP website How can I add this. I have added revolution slider plugin -

http://ift.tt/1S53oRX

or

http://ift.tt/25laeN7

But not figure out what to do next.



via Chebli Mohamed

wordpress website automatically changed the permission from 755 to 000 in cpanel

I was created a wordpress site, the link is applestudycare.com. After this hosting in my shared CPanel, the site folder permission automatically changed every time as 000. This problem occurred above one month. Any one can help me?



via Chebli Mohamed

How to install a wordpress theme I purchased from ThemeForest?

I purchased a wordpress theme from themeforest. I made a free wordpress account and went on Appearance > Themes. But I don't see "Add New" to add my wordpress theme. How to I install my wordpress theme?



via Chebli Mohamed

WooCommerce shared stock with different quantities

Is there a way to share WooCommerce inventory with items that vary in both quantity and price? For example:

1 person ski ticket and 1 hotel room for $100 2 people ski ticket and 1 hotel room for $175 3 people ski ticket and 1 hotel room for $200

I need to tack the inventory because they only have X number ski tickets that they have to sale for example. So lets say its 50, they need to subtract 1,2 or 3 from that in the above example to avoid over sale.

Any suggestions???



via Chebli Mohamed

Table not updating with wordpress dbdelta

I have following code for creating table:

$sql = "CREATE TABLE " . $table_name . "("
         . "id mediumint(9) NOT NULL AUTO_INCREMENT, "
         . "product_id mediumint(9) DEFAULT 0 NOT NULL,"
         . "name_type mediumint(9) NOT NULL, "
         . "name_key varchar(48) NOT NULL, "
         . "valid_until datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "created_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "updated_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "UNIQUE KEY id (id)"
         . ")" . $charset_collate. ";";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );

It is working and table created.

Now I need update table and add new column (sites_list):

$sql = "CREATE TABLE " . $table_name . "("
         . "id mediumint(9) NOT NULL AUTO_INCREMENT, "
         . "product_id mediumint(9) DEFAULT 0 NOT NULL,"
         . "name_type mediumint(9) NOT NULL, "
         . "name_key varchar(48) NOT NULL, "
         . "sites_list longtext, "
         . "valid_until datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "created_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "updated_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, "
         . "UNIQUE KEY id (id)"
         . ")" . $charset_collate. ";";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );

But this not work.

And I has a error:

WordPress database error: [Table 'table_name' already exists]

What is incorrect?

Thanks.



via Chebli Mohamed

How to make all flags being displayed on page load instead of being shown only when :hover - WPML

I have a question and request for a tip, help on how can I make the language flags being displayed with out every time and hover on the flag to see other available flags to klick on ?

I am using WP plugin called WPML and everything is ok, but the other flags are visible only when you hover on the current flag and I would like them to be always displayed on all pages from the start when it loads the website. How can I make this possible ??

Here is my website: http://ift.tt/1UhsjZ0

And as wel I am facing issue with displaying all those language flags in SAFARI browser. Any solutions for Safari as well ?

Thanks for help in advance, B.R.



via Chebli Mohamed

Multi currency switcher - Wordpress Plugin

We are working on an woocommerce website and are looking to integrate currency converter. The issue here is that we have multiple currencies available against the items and need to convert these to ETB. We have gone through Open Exchange Rate API however, not of much help. Any references or plugins which we can use would be of great help.

Thanks



via Chebli Mohamed

get full order detail from woocommerce to my custom plugin

i want to get full order detail from woocommerce as customer name, shipping detail, product name , email etc , actually i want this detail in custom plugin so i need full detail of products and orders Thanks



via Chebli Mohamed

I want to add an options page to my wp plugin

I want to add an options page to my wp plugin but it is not being displayed. I had copied this code from an earlier plugin of mine. Please notify if you see any discontinuation of code. A bunch of thanks in advance!

//Registering fields for the settings page
function SPIG_settings_init(  ) { 
register_setting( 'pluginPage', 'SPIG_settings' );
add_settings_section(
'SPIG_pluginPage_section', 
__( 'This is the options page for the Scattered Polaroid Image Gallery plugin.', 'wordpress' ), 
        'SPIG_settings_section_callback', 
        'pluginPage'
    );

    add_settings_field( 
        'SPIG_text_field_0', 
        __( 'Select the color of the overlay.', 'wordpress' ), 
        'SPIG_text_field_0_render', 
        'pluginPage', 
        'SPIG_pluginPage_section' 
    );

    add_settings_field( 
        'SPIG_text_field_1', 
        __( 'Select the color of the polaroid backgrounds.', 'wordpress' ), 
        'SPIG_text_field_1_render', 
        'pluginPage', 
        'SPIG_pluginPage_section' 
    );

    add_settings_field( 
        'SPIG_text_field_2', 
        __( 'Select the background color of the gallery section.', 'wordpress' ), 
        'SPIG_text_field_2_render', 
        'pluginPage', 
        'SPIG_pluginPage_section' 
    );


}
add_action( 'admin_init', 'SPIG_settings_init' );

//Callback function to display the overlay color field 
function SPIG_text_field_0_render(  ) { 

    $options = get_option( 'SPIG_settings' );
    ?>    

    <input class='color-field' type="text" name='SPIG_settings[SPIG_text_field_0]' value='<?php echo $options['SPIG_text_field_0']; ?>'/> 
    <?php

}

//Callback function to display the background color picker field 
function SPIG_text_field_1_render(  ) { 

    $options = get_option( 'SPIG_settings' );
    ?>
    <input type='text' class='color-field' name='SPIG_settings[SPIG_text_field_1]' value='<?php echo $options['SPIG_text_field_1']; ?>'>
    <?php

}

//Callback function to display the polaroid color picker field 
function SPIG_text_field_2_render(  ) { 

    $options = get_option( 'SPIG_settings' );
    ?>                               

    <input type='text' class='color-field' name='SPIG_settings[SPIG_text_field_2]' value='<?php echo $options['SPIG_text_field_2']; ?>'>
    <?php

}

//Callback function to display the subtext under the title
function SPIG_settings_section_callback(  ) { 

    echo __( 'This is the options page for the Scattered Polaroid Image Gallery plugin.', 'wordpress' );

}

//Creating the settings page
function SPIG_options_page(  ) { 

    ?>
    <form action='options.php' method='post'>
        <i class="dashicons dashicons-format-gallery"></i><h2>Scattered Polaroid Image Gallery</h2>

        <?php
        settings_fields( 'pluginPage' );
        do_settings_sections( 'pluginPage' );
        submit_button();
        ?>

    </form>
    <?php

}

function SPIG_menu_page(){
    add_menu_page('Scattered Polaroid Image Gallery','Scattered Polaroid Gallery','manage_options',__FILE__,'SPIG_options_page','dashicons-images-alt');
} 
add_action('admin_menu','SPIG_menu_page'); 



via Chebli Mohamed

how to live exchange currency rate on WordPress eCommerce website?

i worked on a website called http://ift.tt/1SeGnif here is the difference difference prices of all products, i just want to show currency in Ethiopian birr when i upload data on many others currency not a single one, and when any currency are fluctuate every day my all products rate will remain change according to the exchange of currency, i have to see many plugins in wordpress but no one is comfortable on these requirements. anyone please suggest me how to change currency of my website with flexible rates of currency.

Thanks in Advance



via Chebli Mohamed

lundi 21 mars 2016

Pass dynamically generated select box name into $_POST array

To make an WordPress widget I created a select box which gets options generated dynamically from $post object. The select box's name is also generated by dynamically. Here is the code

<select class="widefat" name="<?php echo $this->get_field_name( 'employee' );?>" id="<?php echo $this->get_field_id( 'employee' ); ?>">

Results this :

<select class="widefat" name="widget-employee[13][department]" id="widget-employee-13-department">

To check the value of the select box I need to pass it to $_POST Array.

How do I pass the select box's value to $_POST array ?

Thanks in advance.



via Chebli Mohamed

Wordpress site design

I'm planning to build a site about musicians, where they can register, input their informations about: formation, music style, which music instrument they play, their city, and so on.

People who worked with them, has hired them, etc., if registered, can create a review and rate them, based on some criterias such as, knowledge, price, stage presence, ..., and it will result in a summary rate which will be their final rate.

Visitors can search for musicians using terms like music intrument, music style, city, and the search result will show the rank order, and the visitors can see all the musician informations.

My doubt is, how do I set up my wordpress website? should I make every registered musician an author so they can create a "post" with their information, setting the maximum post per author as 1, or should I make a static site and post their profile information as a page and rank it up?

If someone has some insights, tips, plugin tips, themes tips, etc., it will be pretty handy.

I want to make a site like this: http://ift.tt/22AHkGk



via Chebli Mohamed

NextGen & Slidehow Conflicting

I have wordpress website that i wanted to add some picture to my pages and i have used nextgen plugin that provides bigger picture when you click that shows some pop-up picture.It's working perfectly.But in my home page there is slider that shows only one picture when i run the nextgen the other plugin which is slideshow does not working on the home page.this is when i disable the nextgen

And this is when i enable

I think 2 plug in confligting each other.Is there a any solution that i can close this nextgen for the homepage ?



via Chebli Mohamed

To save text of Dialog Box in database table having name "wp_comments"

How we can save text of Dialog Box in database table having name "wp_comments". WP-DISCUZ plugin have been used to show comments on published Articles. What we have customized is that when User publish a article, it will sent to Admin for approval. If admin Rejects it with a comment (this comment box will reflect as dialog box) then the commented text should save in database table "wp_comments". How can we implement this.

 /* WordPress Function to Insert Comment */

    function wp_insert_comment( $commentdata ) {
        global $wpdb;
        $data = wp_unslash( $commentdata );

        $comment_author       = ! isset( $data['comment_author'] )       ? '' : $data['comment_author'];
        $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email'];
        $comment_author_url   = ! isset( $data['comment_author_url'] )   ? '' : $data['comment_author_url'];
        $comment_author_IP    = ! isset( $data['comment_author_IP'] )    ? '' : $data['comment_author_IP'];

        $comment_date     = ! isset( $data['comment_date'] )     ? current_time( 'mysql' )            : $data['comment_date'];
        $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt'];

        $comment_post_ID  = ! isset( $data['comment_post_ID'] )  ? '' : $data['comment_post_ID'];
        $comment_content  = ! isset( $data['comment_content'] )  ? '' : $data['comment_content'];
        $comment_karma    = ! isset( $data['comment_karma'] )    ? 0  : $data['comment_karma'];

        $comment_approved = ! isset( $data['comment_approved'] ) ? 1  : $data['comment_approved'];

        $comment_agent    = ! isset( $data['comment_agent'] )    ? '' : $data['comment_agent'];
        $comment_type     = ! isset( $data['comment_type'] )     ? '' : $data['comment_type'];
        $comment_parent   = ! isset( $data['comment_parent'] )   ? 0  : $data['comment_parent'];

        $user_id  = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];

        $compacted = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' );
        if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) {
            return false;
        }

        $id = (int) $wpdb->insert_id;

        if ( $comment_approved == 1 ) {
            wp_update_comment_count( $comment_post_ID );
        }
        $comment = get_comment( $id );

        /**
         * Fires immediately after a comment is inserted into the database.
         *
         * @since 2.8.0
         *
         * @param int $id      The comment ID.
         * @param obj $comment Comment object.
         */
        do_action( 'wp_insert_comment', $id, $comment );


        wp_cache_set( 'last_changed', microtime(), 'comment' );

        return $id;
    }


/* The function that will executed on Rejection by Admin */

  $(".reject-post-status").on('click', function () {
        // alert($(this).attr("id"))
        var pid = $(this).attr("id");
        $('#dialog').dialogBox({
            hasClose: false,
            // effect: 'fade',
            width: 800,
            height: 300,
            hasBtn: true,
            confirmValue: 'OK',
            cancelValue: 'Cancel',

            confirm: function () {

                $.ajax({
                    type: "POST",
                    url: 'http://ift.tt/1WC3OTG' + pid,
                    data: { message: $('#comment').val() },

                    success: function (html) {
                        // alert(html);
                        window.location.href = 'http://ift.tt/1WC3PHq';
                    }

                });

            },
            content: '<textarea rows="6" cols="105" id="comment" required></textarea>',
            title: "Add Comment"

        });
        return false;

    });



via Chebli Mohamed

WordPress Post Excerpts Displaying Twice

I'm using the Display Posts Shortcode plugin to pull excerpts into a WordPress Index.php template in a child theme of Twenty Thirteen.

This is the shortcode:

<?php echo do_shortcode( '[display-posts include_excerpt="true" post_status="publish" posts_per_page="3" wrapper="div"]' ); ?>

I have very few arguments. When I turn off the argument to include the excerpts, only the titles display twice.

I've turned off every plugin and that did not solve the issue. Any ideas?



via Chebli Mohamed

dimanche 20 mars 2016

Wordpress Can't use query var on Static Front-Page

I've a plugin with this code:

//this function is called on plugin activation
public function socidynamo_rewrite_rule() {
 add_rewrite_endpoint( 'plugin-name', EP_ALL);
}

//this gets triggered by query_vars filter
public function plugin-name_register_query_var( $vars ) {
    $vars[] = 'plugin-name';
    return $vars;
}

It essentially adds a rewrite endpoint and a query var so pages could be loaded using http://ift.tt/1WBhoa5. It works as expected, so if echo get_query_var('plugin-name'); it returns passed value. Problem is when you set page as static front-page, so url changes to http://ift.tt/1LzRPps this breaks everything and just get a nothing found message..

Any help would be really appreciated



via Chebli Mohamed

Create subscription to woocommece subscription in admin-ajax

I need to create an action where you get the parameters via GET and the admin-ajax, create the Subscription of Woocommerce Subscription. Can someone help me?



via Chebli Mohamed

Unordered List CSS in Qards WP Plugin

I am using Qards plugin for WordPress. The plugin does not have an option to add bullet list in the visual editor. I have attempted to add UL/LI list but the list does not show up in preview.

I want to add UL list with standard circle. Once I have it visible in preview I will be able to style it with CSS Hero plugin.

Screen Shot of Visual Editor Link to page Here is the HTML.

<section class="grid column-3 image-1 top-padding-10 bottom-padding-1 ">
  <div class="section-bg section-color" style="background-color: #ffffff; opacity: 1;"></div>
  <div class="container">
    <h1 style=" font-family: 'Crete Round', serif;  font-weight: bold;  font-style: normal; " class=" font-size-4  line-height-6 ">
      Seeking Creative, Passionate People.
    </h1>
    <p style=" text-align: center;  font-family: 'Hammersmith One', sans-serif;  font-style: normal; " class=" font-size-3  line-height-2 ">
      We think that great real estate can help create magic!
    </p>
    <p style=" text-align: center;  font-family: 'Hammersmith One', sans-serif;  font-style: normal; " class=" font-size-3  line-height-2 ">
      The synergy between people and architectural spaces
    </p>
    <p style=" text-align: center;  font-family: 'Hammersmith One', sans-serif;  font-style: normal; " class=" font-size-3  line-height-2 ">
      drives <font color="#707070">creativity</font> and leads to the establishment of stable,
    </p>
    <p style=" text-align: center;  font-family: 'Hammersmith One', sans-serif;  font-style: normal; " class=" font-size-3  line-height-2 ">
      profitable businesses
    </p>
    <ul class="grid-list">
      <li class="image-grid-item ">
        <div class="image" style="background-image: url(http://ift.tt/1pV5NrP)"></div>
        <div class="description-holder">
          <div>
            <div>
              <h3 style=" color: rgb(66, 66, 66);  font-family: Montserrat, sans-serif;  font-weight: bold;  font-style: normal; " class=" font-size-4  line-height-4 ">
                Bespoke Real Estate Service
              </h3>
              <ul style="list-style-type:circle">
                <li>Custom Market Research</li>
                <li>Needs Analysis</li>
                <li>Negotiation</li>
              </ul>
            </div>
          </div>
        </div>
      </li>
      <li class="image-grid-item ">
        <div class="image" style="background-image: url(http://ift.tt/22wGtqi)"></div>
        <div class="description-holder">
          <div>
            <div>
              <h3 style=" color: rgb(66, 66, 66);  font-family: Montserrat, sans-serif;  font-weight: bold;  font-style: normal; " class=" font-size-4  line-height-4 ">
                Tech Tools
              </h3>
              <ul>
                <li>Tour Book App</li>
                <li>Online Deal Management</li>
                <li>Lease Analysis &amp; Comparison</li>
              </ul>
            </div>
          </div>
        </div>
      </li>
      <li class="image-grid-item ">
        <div class="image" style="background-image: url(http://ift.tt/1pV5NrR)"></div>
        <div class="description-holder">
          <div>
            <div>
              <h3 style=" color: rgb(66, 66, 66);  font-family: Montserrat, sans-serif;  font-weight: bold;  font-style: normal; " class=" font-size-4  line-height-4 ">
                Creative Scenarios
              </h3>
              <ul>
                <li>Shared Office Leasing</li>
                <li>Unique Spaces</li>
                <li>Multi-Use Facilities</li>
                <li>Integrated with PublicTransit</li>
                <li>Offset Your Annual Rent with SXSW &amp; Event Subleasing </li>
              </ul>
            </div>
          </div>
        </div>
      </li>
    </ul>
  </div>
</section>

Seeking Creative, Passionate People. We think that great real estate can help create magic!

The synergy between people and architectural spaces drives creativity and leads to the establishment of stable, profitable businesses http://ift.tt/1pV5NrP)"> Bespoke Real Estate Service
  • Custom Market Research
  • Needs Analysis
  • Negotiation
  • http://ift.tt/22wGtqi)"> Tech Tools
  • Tour Book App
  • Online Deal Management
  • Lease Analysis & Comparison
http://ift.tt/1pV5NrR)"> Creative Scenarios
  • Shared Office Leasing
  • Unique Spaces
  • Multi-Use Facilities
  • Integrated with PublicTransit
  • Offset Your Annual Rent with SXSW & Event Subleasing

Assign an attachment to a taxonomy when uploading media

I'm creating a plugin that adds a downloads section to the WP admin. I'm using a taxonomy for categories and then want to be able to upload media into these categories.

I've got everything working in terms of displaying the taxonomies and the attachments that will be assigned to them.

The problem I'm having is assigning the attachment to the taxonomy once it's uploaded. I'm trying to use the add_attachment hook but I can't seem to pass the taxonomy ID to it. I've tried using get_query_var (I have the taxonomy ID as a GET parameter) and get_current_screen but that just returns the async-upload screen value.



via Chebli Mohamed

get_current_user_id() returning Zero 0

get_current_user_id() is returning 0 for following codes. I do tried some solution available on stack overflow but somehow not working for me. I'm expecting explanation why its returning zero and how to fix?

P.S: I'm calling get_current_user_id() from external php page and included '../wp-blog-header.php' for that.

Code:

<?php
require('../wp-blog-header.php');
get_header();

$user_ID = get_current_user_id(); 
echo $user_ID;

?> 



via Chebli Mohamed

samedi 19 mars 2016

Custom Fields Pro : Remove $ symbol from output field

I have a site for a business. It is done in wordpress and uses advanced custom fields pro (plugin) to set prices for services. I didn't write the site!!! There is a custom field set that you enter a number and it shows '$ number' on the site. I need to change the number field to accept a text string. I figured that out. Problem is there is still a $ symbol that shows on the page (the control in acf for this isn't set. So I looked around. and found this string on a home.php page:

foreach ($singleservice as $row) {
                $info = $row['service_information'];
                $price = $row['service_price'];
                $price = '$'.$price;
                echo '<div class = "singleservice clearfix">
                    <div class = "text">'
                        .$info.
                    '</div><!--text-->
                    <div class = "price">'
                        .$price.
                    '</div><!--price-->
                </div><!--singleservice-->';

It has been awhile since I've done any coding and would have thought the coder set this in afc plugin. But can I just change the above line: $price = '$'.$price; >to> $price = $price; ? OR am I missing something with the plugin or something else. I don't want to break anything big!!! I appreciate the help and knowledge here, thank you.



via Chebli Mohamed

Calculate Age in Gravity FForms

I'm trying to calculate the age from the date of birth provided by user in Gravity Form. Now the thing is that I want the age to be stored in a hidden field in the gravity form so that I can use conditional login on that hidden field.

I've added a datepicker for the date of birth, but not sure if my function is ok to calculate the exact age and return it to a parameter which I can use in a hidden field.

Here is the code I've written:

add_filter("gform_field_value_age", "_populate_age");
function _populate_age( $result, $value, $form, $field ){
    $age = date('Y') - substr($value, 6, 4);
    return $age;

}

I know my function is wrong but I was hoping someone can help me out on this.



via Chebli Mohamed