Category Archives

21 Articles

How Author WordPress post a iframe

Today, I am gone to tell you several solutions to post iframe on your website especially if your website is using WordPress with author role user

  1. Create the shortcode

Put this code to your function.php in your child theme:

//function to initialise the iframe elements
add_shortcode( 'iframe' , 'mycustom_shortcode_iframe' );
function mycustom_shortcode_iframe($args, $content) {
    $keys = array("src", "width", "height", "scrolling", "marginwidth", "marginheight", "frameborder");
    $arguments = mycustom_extract_shortcode_arguments($args, $keys);
    return '<iframe ' . $arguments . '></iframe>';
}

function mycustom_extract_shortcode_arguments($args, $keys) {
    $result = "";
    foreach ($keys as $key) {
        if (isset($args[$key])) {
            $result .= $key . '="' . $args[$key] . '" ';
        }
    }
    return $result;
}
//End - the iframe elements

Then put this example

[iframe width="100%" height="325" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.google.com/publicdata/embed?ds=d5bncppjof8f9_&amp;ctype=l&amp;strail=false&amp;bcs=d&amp;nselm=h&amp;met_y=sp_pop_grow&amp;scale_y=lin&amp;ind_y=false&amp;rdim=region&amp;idim=country:IDN:VNM:SGP:PHL:MYS:THA:MMR&amp;ifdim=region&amp;tstart=756144000000&amp;tend=1481990400000&amp;hl=en_US&amp;dl=en&amp;ind=false&amp;xMax=-78.84445062499992&amp;xMin=20.823518125000078&amp;yMax=-46.612215914352305&amp;yMin=52.220622466601796&amp;mapType=t&amp;icfg&amp;iconSize=0.5"]

2. Add function to Author
Add this code to your function.php

function add_theme_caps() {
    // gets the author role
    $role = get_role( 'author' );

    // This only works, because it accesses the class instance.
    // would allow the author to edit others' posts for current theme only
    $role->add_cap( 'unfiltered_html' ); 
}
add_action( 'admin_init', 'add_theme_caps');

you can put your iframe code without any change, but “This is a bad idea and you might as well just give those users “higher” roles as with the “unfiltered_html” permission it is not very hard to duplicate the admin authorization cookies and take control of the site.” – quotes

Which one do you prefer?

 

Error Radio Button Checklist with Javascript

if you meet the problem Uncaught TypeError: Cannot set property ‘checked’ of null, the issue can be that the script is executed before the checkbox was part of the DOM.

the solution is to use addEventListener & DOMcontentLoaded inside your javascript

document.addEventListener("DOMContentLoaded", function() {
  document.getElementById("test").checked = true;
});

 

 

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.

Hi frenjo,

Have you ever meet error with phpmyadmin with problems display error like these “You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.”

if the answer is yes, you should modify your php.ini. In this section, I am going to tell you how to solve the problem which is Debian Linux server.

  • Login Putty
  • sudo su <– login as a root/administrator
  • cd etc/php5/apache2
  • nano php.ini
  • search below this code and change the value
php_value upload_max_filesize 120M //file size
php_value post_max_size 120M
  • save file ctrl + o -> enter -> ctrl + z
  • restart your apache or your server

solved!

 

Phpmyadmin unable opening any table after install vesta panel

Hi frenjo,

Sometimes clients don’t want to know if you don’t have knowledge about the new environments or technologies that did you have.  Then you just have to prove that you could adapt for everything changes. This week, I play with several digital ocean droplets which is the new for me in the past for cloud server and the fresh installer could be ruining your day to day if you don’t solve it soon. Here the problem I got when tried to access database in phpmyadmin:

SELECT command denied to user 'user'@'localhost' for table 'pma_table_uiprefs' 

Here the solution

  1. Open your console / Putty
  2. login
  3. sudo su –> for super administrator
  4. Paste or Write this code into your console
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-debian.sh && chmod +x pma-debian.sh && ./pma-debian.sh

the code is for Debian OS server 8.x, if you are using others server. click this link

 

Solved!