Are you the publisher? Claim or contact us about this channel

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

older | 1 | .... | 367 | 368 | (Page 369) | 370 | 371 | .... | 413 | newer

    0 0

    Hi everyone,
    This maybe a hard one but this is what I'm after and I will appreciate any help any of you guys can give.

    I want to set it up on woocommerce (only some sites in a multi-site though) so when a customer orders it places them on a hold page, then an email is sent to the admin with the order amount, the shipping post code and the time chosen for delivery, the email also needs a button/link with accept or decline.

    if accept the customer is told the order is accepted and payment is taken (or if cod is moved to order complete screen)

    If declined the order is cancelled and a message is given to the customer on the site saying the order can be fulfilled and a custom message.

    the idea is this is a fast food ordering system so needs to be live and if it gets too busy or the order is of little value/too far away the shop can decline the order at will.

    any idea how this could be done?

    my website is but is getting migrated 26/03/16 so maybe done for a bit while this happens if you want to check it out.

    0 0

    Hello everybody,

    I already know that many of you will beat me hard for this, BUT please after beating me try to help.

    I hacked the wordpress password generator to automatically generate ALWAYS THE SAME DEFAULT password. That is, let's say, "hello" (no quotes).

    I need to keep it like that, and I won't consider ANY solution that advise me to alter this condition.

    Having done that, I need to close all the backdoors that hackers may use.

    To protect subscribers, I disabled the profile page, and they have to contact me to access their data.

    But most important, I needed to disable the "Lost your password" function from wp-login.php.

    WHAT A PAIN! All the plugins and hacks that I tried were just removing the link to the password reset form, (i.e. the link to /wp-login.php?action=lostpassword) but I was still able to reach it by manually typing:

    The big problem here is, the same function used to generate a random password, that I altered to always output "hello", is used ALSO to generate the random password reset key. So the random password reset key is ALWAYS hello.

    Now, let's assume that the administrator, nickname John, has a super complicated password.

    If somebody gets the admin username or email (easy), they just type:

    Enter the admin username or email and send the form. Now the password reset key "hello" is active.

    Then they type:

    Here they set their own password: they are in and John's OUT!

    I found several methods to prevent the password reset for specific users, using the hook allow_password_reset from user.php but, probably due to my limited php competences, none of them was working.

    All I could get was hiding the link from wp-login.php to wp-login.php?action=lostpassword .

    To quickly patch this big hole I just prevented user.php from generating ANY password reset key.

    line 1947
    // $key = wp_generate_password( 20, true );

    (please note the EXTREMELY elegant // solution)

    Thanks to this, there is no password reset key and none of the following link appears to be valid

    So two questions:

    1- Can I do it in a different way??

    2- Is there any other backdoor that I'm leaving open for hackers?

    Thanks a lot for your help


    PS: If you are going to answer that having such a password generator is dangerous for me, for the users and for the world, without providing me with a solution to my questions, or that "YES, the holes are huge and cannot be enumerated", please refrain from asnwering. I'll appreciate your silence

    0 0

    I'm gonna deploy my first plugin but the _e() and __() functions seem don't work.

    In my comments header:

    Text Domain: add-to-post-footer
    Domain Path: /languages

    I created .po and .mo files with poedit and put them in /languages in my plugin. I translated to portuguese and named as 'pt_BR.po/mo'. In my option page I have some texts as follows:

    <?php echo __( 'With ', 'add-to-post-footer').ATPF_PLUGIN_NAME.__(' you can add some content at the final of all your posts without care about forget some of them, or the need to copy and paste boring proccess. Just go to Posts >> ', 'add-to-post-footer').ATPF_PLUGIN_NAME.__(', insert the content and save it. The proccess is the same to change the content. You just have to care about other stuff of your site/blog now', 'add-to-post-footer'); ?>

    But when I put in my localhost wordpress installation, language brazilian portuguese, nothing happens (just the save button, because Save is already translated by default on WP)

    What am I doing wrong?

    0 0

    I was making a custom theme options page for a wordpress theme following this tutorial:

    Everything was fine until I added the color picker function and script. Now every time I go onto the theme options page it's just a blank screen with an error from firebug. as shown in this picture.

    I deleted the color picker stuff but it's still doing it. I'm fairly new to javascript and php so i have no idea what's going on here.

    Here's the code for my theme options page.

    function mb_options_admin_menu() {
    $page = add_theme_page( 'Theme Options', 'Theme Options', 'edit_theme_options', 'mb_options-theme-options', 'mb_options_theme_options' );
    add_action( 'admin_print_styles-' . $page, 'mb_options_admin_scripts' );
    add_action( 'admin_menu', 'mb_options_admin_menu' );
    function mb_options_admin_scripts() {
    // We'll put some javascript & css here later
    function mb_options_theme_options() {
    <div class="wrap">
        <div id="icon-themes" class="icon32" ><br></div>
        <h2>My Theme Options</h2>
        <form method="post" action="options.php">
            <?php wp_nonce_field( 'update-options' ); ?>
            <?php settings_fields( 'mb_options-theme-options' ); ?>
            <?php do_settings_sections( 'mb_options-theme-options' ); ?>
            <p class="submit">
                <input name="Submit" type="submit" class="button-primary" value="Save Changes" />
            </p >
    function mb_options_admin_init() {
    register_setting( 'mb_options-theme-options', 'mb_options-theme-options' );
    add_settings_section( 'section_general', 'General Settings', 'mb_options_section_general', 'mb_options-theme-options' );
    add_settings_field( 'link_color', 'Link Color', 'mb_options_setting_color', 'mb_options-theme-options', 'section_general' );
    add_settings_field( 'link_hover_color', 'Link Hover Color', 'mb_options_hover_setting_color', 'mb_options-theme-options', 'section_general' );
    add_action( 'admin_init', 'mb_options_admin_init' );
    function mb_options_section_general() {
    _e( 'The general section description goes here.' );
    function mb_options_setting_color() {
    $options = get_option( 'mb_options-theme-options' );
    <input type="text" name="mb_options-theme-options[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>" />
    function mb_options_hover_setting_color() {
    $options = get_option( 'mb_options-theme-options' );
    <input type="text" name="mb_options-theme-options[link_hover_color]" value="<?php echo esc_attr( $options['link_hover_color'] ); ?>" />
    function mb_options_link_color() {
    $options = get_option( 'mb_options-theme-options' );
    $link_color = $options['link_color'];
    $link_hover_color = $options['link_hover_color'];
    echo "<style> a { color: $link_color; } a:hover { color: $link_hover_color; } </style>";
    add_action( 'wp_enqueue_scripts', 'mb_options_link_color' );

    0 0

    I want to restrict access to this directory. I have one plugin that uses ajax.php for measuring stats (outbound links) that keeps me from blocking it off entirely except to my IPs for my machines.

    I think if I specify the referrer as the site itself being allowed that would enable the stats script. Not sure how to write it.

    Sample apache server directive with Centos

    <Directory "/var/www/html/sites/xxxx/wp-admin/">
    Order Deny,Allow
    Allow from nn.nnn.n.0/16
    Allow from nn.nn.nnn.nnn
    Deny from all

    0 0

    Hello ! :)

    As part of my studies, I have to create a wordpress plugin. I encounter 2 problems

    - I would like to upload an image and insert it in my database table. For the time I get there but it is inserted in the register post type and not in my database (I use the wp media)

    - I use register post type, but he inserted into the table by default (wp_post) how can I change the table?

    Thank you !

    0 0

    I am following the widgets codex example to create my first custom widget, and I am having an issue where the widget fields empty themselves on save within the widgets admin page. I'm guessing something in the update method is incorrect, but I'm not sure what.

    Any help is appreciated!

    I cannot get the code formatting to work in this post, so here is a pastebin link.

    0 0

    Hi Members

    I have submitted my sitemap GWT but can't get it indexed, I reckon its because of robot txt. At the moment this is what it shows:
    User-agent: *
    Disallow: /wp-admin/
    Allow: /wp-admin/admin-ajax.php

    then my sitemap
    Can anyone see what is happening here as I am a complete noob.
    Thanks in Advance

    0 0

    I'm trying to build a theme options page and have been successful until i added a tabs menu. Since adding the tabs the options no longer save.

    Here is my code.

    function mb_admin_menu() {
        $page = add_theme_page( 'Theme Options', 'Theme Options', 'edit_theme_options', 'mb-theme-options', 'mb_theme_options' );
        add_action( 'admin_print_styles-' . $page, 'mb_admin_scripts' );
    add_action( 'admin_menu', 'mb_admin_menu' );
    function mb_admin_scripts() {
        wp_enqueue_style( 'farbtastic' );
        wp_enqueue_script( 'farbtastic' );
        wp_enqueue_script( 'my-theme-options', get_template_directory_uri() . '/js/theme-options.js', array( 'farbtastic', 'jquery' ) );
    function mb_theme_options( $active_tab = '' ) {
        <div class="wrap">
            <div id="icon-themes" class="icon32" ><br></div>
            <h2>My Theme Options</h2>
    if( isset( $_GET[ 'tab' ] ) ) {
        $active_tab = $_GET[ 'tab' ];
    } // end if
    <?php if( isset( $_GET[ 'tab' ] ) ) {
    			$active_tab = $_GET[ 'tab' ];
    		} else if( $active_tab == 'general-options' ) {
    			$active_tab = 'general-options';
    		} else {
    			$active_tab = 'color-options';
    		} // end if/else ?>
    		<h2 class="nav-tab-wrapper">
    		    <a href="?page=mb-theme-options&tab=color-options" class="nav-tab <?php echo $active_tab == 'color-options' ? 'nav-tab-active' : ''; ?>">Color Options</a>
    			<a href="?page=mb-theme-options&tab=general-options" class="nav-tab <?php echo $active_tab == 'general-options' ? 'nav-tab-active' : ''; ?>">General Options</a>
            <form method="post" action="options.php">
                <?php wp_nonce_field( 'update-options' ); ?>
                <?php if( $active_tab == 'color-options' ) {
                settings_fields( 'mb-color-options' );
                do_settings_sections( 'mb-color-options' );
    		} else {
    			settings_fields( 'mb-general-options' );
                do_settings_sections( 'mb-general-options' );
    		} // end if/else
    		 submit_button(); ?>
    function mb_admin_init() {
        register_setting( 'mb-color-options', 'mb-color-options' );
        add_settings_section( 'section_colors',  'Color Settings', 'mb_section_colors', 'mb-color-options' );
        add_settings_field( 'link_color', 'Link Color', 'mb_setting_color', 'mb-color-options', 'section_colors' );
    	add_settings_field( 'link_hover_color', 'Link Hover Color', 'mb_hover_setting_color', 'mb-color-options', 'section_colors' );
    add_action( 'admin_init', 'mb_admin_init' );
    function mb_section_colors() {
        _e( 'The general section description goes here.' );
    function mb_setting_color() {
        $options = get_option( 'mb-color-options' );
        <input class="link_color" type="text" name="mb-theme-options[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>" />
    	<input type='button' class='select_color button-secondary' value='Select Color'>
        <div class='color_picker' style='z-index: 100; background:#f1f1f1; position:absolute; display:none;'></div>
    	<input type='button' class='reset_color button-secondary' value='Reset'>
    function mb_hover_setting_color() {
        $options = get_option( 'mb-color-options' );
        <input class="link_color" type="text" name="mb-theme-options[link_hover_color]" value="<?php echo esc_attr( $options['link_hover_color'] ); ?>" />
    	<input type='button' class='select_color button-secondary' value='Select Color'>
        <div class='color_picker' style='z-index: 100; background:#f1f1f1; position:absolute; display:none;'></div>
    	<input type='button' class='reset_color button-secondary' value='Reset'>
    function mb_link_color() {
        $options = get_option( 'mb-theme-options' );
        $link_color = $options['link_color'];
    	$link_hover_color = $options['link_hover_color'];
        echo "<style> a { color: $link_color; } a:hover { color: $link_hover_color; } </style>";
    add_action( 'wp_enqueue_scripts', 'mb_link_color' );

    Is anyone able to point out why the options are not saving since adding the tabs ?

    0 0


    I am new at Wordpress. I want to put slider starting at the top of the header. Where do I have to put the code?

    Thank you

    0 0
  • 10/31/15--04:43: >>Sara
  • Hey there I'm here to ask your support for an Hamletic doubt:

    I'm using a plugin (Monarch) to show social buttons for share a page. The plugin allows me to positioning these buttons in several places but none of these places is good for my theme.

    See the screenshot:

    Unfortunately the plugin do not provide any shortcode for positioning the buttons in custom places.

    There's a way to move these button where I want maybe building another plugin that provide a shortcode? Is it science fiction?

    Thanx for ur time!

    0 0

    I'm trying to set up an ajax login for a cordova based app. I am building it into the theme functions.php

    It was working, then has just stopped working. No new plugins or updates that I am aware of to the core.

    So far I have switched from get to post and vice versa. I tried standard jquery ajax call and the xhr method as shown below, but I am having no luck.

    Probably a stupid error, but I am not finding it.

    function login()
    		 	$creds['user_login'] = $_GET["username"];
    			$creds['user_password'] = $_GET["password"];
    			$return = array(); //What we send back
    		if( !empty($_GET["username"]) && !empty($_GET["password"]) && trim($_GET["username"]) != '' && trim($_GET["password"] != '') ){
    			$credentials = array('user_login' => $_GET["username"], 'user_password'=> $_GET["password"], 'remember' => 'true');
    			$loginResult = wp_signon($credentials);
    			$user_role = 'null';
    			if ( strtolower(get_class($loginResult)) == 'wp_user' ) {
    				//User login successful
    				$current_user = $loginResult;
    				/* @var $loginResult WP_User */
    				$return['result'] = true;
    				$creds = array();
    	$auth_resp = "TRUE";
    	$creds_id = $current_user->id;
    	$img_url_temp = $current_user->id;
    	$creds_login = $current_user->user_login;
    	$creds_pass = 'correct';
    	$creds_email = $current_user->user_email;
    	$creds_role = $current_user->user_level;
    	$creds_fname = $current_user->user_firstname;
    	$creds_lname = $current_user->user_lastname;
    	$creds_dispname = $current_user->display_name;
    	$creds_imgurl = get_av_url($creds_id);
    	$creds_coverurl = get_cover_url($creds_id);
    	$creds_array = array($auth_resp,$creds_id,$current_user->user_login,$creds_pass,$creds_email,$creds_role,$creds_fname,$creds_lname,$creds_dispname,$creds_imgurl,$creds_coverurl);
    	array_push($creds, $creds_array);
    	header("Content-Type: application/json");
    	echo json_encode($creds);
    			} elseif ( strtolower(get_class($loginResult)) == 'wp_error' ) {
    				//User login failed
    				/* @var WP_Error $loginResult */
    				$return['result'] = false;
    				echo $loginResult->get_error_message();
    			} else {
    				//Undefined Error
    				$return['result'] = false;
    				echo 'An undefined error has ocurred';
    			$return['result'] = false;
    			echo 'Please supply your username and password.';
    		$return['action'] = 'login';
    		//Return the result array with errors etc.
    		//echo json_decode($return);
    add_action("wp_ajax_login", "login");
    add_action("wp_ajax_nopriv_login", "login");
    var xhr = new XMLHttpRequest();"get", ajaxurl + "?action=login&username=" + encodeURIComponent(usernameF) + "&password=" + encodeURIComponent(passwordF));
        xhr.onload = function(){
    		var creds = [];
    		var user_info_storage = "";
    		var log = "";
    		var id = "";
    		var login_array = JSON.parse(xhr.responseText);
    		var creds_login = "";
    		var creds_pass = "";
    		var creds_email = "";
    		var creds_role = "";
    		var creds_fname = "";
    		var creds_lname = "";
    		var creds_dispname = "";
    		var creds_imgurl = "";
    		var creds_coverurl = "";
    		for(var count = 0; count < login_array.length; count++)
                log = login_array[count][0];
                id = login_array[count][1];
                creds_login = login_array[count][2];
                creds_pass = login_array[count][3];
    			creds_email = login_array[count][4];
    			creds_role = login_array[count][5];
    			creds_fname = login_array[count][6];
    			creds_lname = login_array[count][7];
    			creds_dispname = login_array[count][8];
    			creds_imgurl = login_array[count][9];
    			creds_coverurl = login_array[count][10];
            if(log == "FALSE")
                // alert("Wrong Username and Password", null, "Wrong Creds", "Try Again");
                    title: 'Login Error',
                    subtitle: '',
                    message: 'Wrong login or password',
                    media: '<i class="trekicons trek-trekfind"></i>'
                $('#login_loader').css('display', 'none');
                $('#login_form').fadeTo('fast', 1, function () {
                    // Animation complete.
            else if(log == "TRUE")
    			if(id == 0){
    				//alert("Incorrect feedback");
    				window.setTimeout(login, 1000);
    			} else {
    			    window.localStorage.setItem("", JSON.stringify([creds]));
    			$('#login_loader').css('display', 'none');
    			//$('#login_form').fadeTo('fast', 1, function () {
    			    // Animation complete.

    0 0

    Hello community WordPress forum.
    I have a need to write the posts the output of a function, but all to getting to do is to display real-time and run this script / function in all posts, with I do to write the posts the output of a function instead of display it in posts?
    because what 's happening is that the script is running on all posts, and each refresh / access the pages, a new script number is generated! I would like the generator create a different number for each post, but write to output them, and not display a number to each new access.

    // Declare the function
    function gen_num()
    $caracteres = "012345678910111213141516171819";
    $mistura = substr(str_shuffle($caracteres),0,10);
    print $mistura;

    // Add custom post content, inject function in content.
    function add_post_content($content) {
    return $content;
    add_filter('the_content', 'add_post_content');

    see in, browse the pages, make f5 to refresh.

    Thank you very much in advance.

    0 0

    How would I propose a change to:


    What I've found is that load_plugin_textdomain() is kind of non-intuitive and the documentation doesn't explain it's actual operation very well.

    Here's what I've discovered:

    The locale name is ALWAYS added to the $domain. For example $domain.'-'.$locale.'.mo' you're trying to load. If it doesn't exist, it doesn't fall back $domain.'.mo'.

    The solution to the problem is to add an action for plugin_locale. The action now looks to see if there's a locale specific file, and if so it returns it. If it doesn't exist, it looks for some close matches. E.G. fr_CA is the locale, then I return fr_FR. Similarly de_AT will return de_DE.

    Finally, if there aren't any matches, then I return en_US because I know I always have $domain.''.

    0 0

    Hi all,

    I have a woocommerce store set up, and the products have variants. These variants display in drop down menu's. I have JavaScript that will take the options from the drop down menus and put them into check boxes. Users who are not logged in will see check boxes.

    I found the template file, wooajax.php, in my theme's /includes/ folder. Here is the file:

    I need to figure out how to work this bit of JavaScript into this file:

    <div class="check-boxes">
    	<?php if (!is_user_logged_in()): ?>
    			function myFunction() {
    					var selects = document.getElementsByTagName('SELECT');
    			    var container = document.getElementById('quickview-content');
    			    // document.getElementsByTagName("SELECT")[0].setAttribute("type", "checkbox");
    			    var i;
    			    for (var x = 0; x < selects.length; x++) {
    			      var select = selects[x];
    			    	for (i = 0; i < select.length; i++) {
    			          var checkbox = document.createElement('input');
    			          checkbox.type = 'checkbox';
    			 = 'option';
    			 = 'randomId' + i;
    			          checkbox.value = select.options[i].text;
    			          var label = document.createElement('label')
    			          label.htmlFor = 'randomId' + i;
    	<?php endif ?>

    I plugged it in on line 84, in the "product-info" div, but this displays the checkboxes at the very bottom of the div and the JavaScript renders in the HTML where the checkboxes should.

    I'm thinking I need to add the script somewhere else, and just call the function here. How do I call a JavaScript function with PHP, and also where else can I put the script? Anywhere else, the var selects returns null because the selects are not rendered yet. It has to be stuck with the AJAX so they render at the same time.

    Any help would be appreciated!

    0 0

    I was wondering if anyone could help me add some code to this plugin, WooCommerce Product Gift Wrap. I really need this plugin to add the extra fee (gift wrapping fee) without it adding it to the price of the product because, if i have a discount on that product and add the gift wrapping to it, it calculates the discount of the gift wrapping fee which it shouldn´t.

    Thank you! :)

    0 0

    Hi Guys, I need some help regarding my new site! So I have created a new wordpress site under the same domain as my old site (im hoping to replace it). Ive done the "backend" of the work assigning the new wordpress site to my existing domain name. *Only thing I havent done is deleting the old sites database (not sure if itll help?). The problem im facing is the Old URL from the old site is still showing up on SERP. Also, my old site has been hacked and the snippets have been changed to inappropriate names. Is there I way I can just remove the old site from the face of the internet (exaggerated, but serious) especially on Google!? Woud deleting the old sites database help?!My site is, If you search Youll see the URL with "php" (thats my old site) is still on the SERP and its being hacked AND warned by Google! Please help!
    Also is there a way to prevent hacking for my new wordpress site!
    Thank you!

    0 0

    What methods can be used to save content here?

    I'm making a plugin to let people add script tags to embed on pages and parse and list query vars to let editors set vars for each page/post.

    I'm not sure abut how best to save the scripts. I want to list them so at first I thought about a custom post type, but that is a bit overkill. All I really need is a couple of fields (title and script content).

    I was thinking maybe to store them in site meta as the scripts are used site wide. Is this a bad idea? If not are there any examples of how to save, and load to the site meta data? Is it as easier as editing post meta data?


    0 0

    Hey all,

    I have a search page that should be filterable by a few custom post types, plus pages.

    I was able to add filters for custom pages by making an anchor tag with the URL parameter of the filter I needed - i.e. $post_type=people or $post_type=post.


    <?php $filterPeople	= '/?s='.$searchStr.'&post_type=people'; ?>
    <a href="<?php echo $filterPeople; ?>">People</a>

    This spits out:

    Which works fine and does exactly what I want it to do for every post_type except page. &post_type=page does not work - it just returns all posts regardless of type.

    I know I can adjust the main query to return only pages, but I'd like to keep the solution as simple as possible.

    I want the end result to look like this:

    <?php $filterPages = /?s='.$searchStr.'&post_type=page'; ?>
    <a href="<?php echo $filterPages; ?>">Pages</a>

    Sorry if this is a repeat or an obvious solution that I'm missing, and thanks in advance!

    0 0

    Woocommerce problem
    I write new action to change button " add to cart " in archive page.

    Here is my code :

    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 );
    'my_woocommerce_template_loop_product_link_close', 5 );

    function my_woocommerce_template_loop_add_to_cart() {
    echo '
    Add to cart <i class="icon-shopping-cart"></i>

    Button changed ! but problem is, when i press " Add to cart " button, it will be redirect to product details page...

    I think i have to do something with : woocommerce_template_loop_product_link_close

    But I dont know how
    So, can you help me ? Thank you !

older | 1 | .... | 367 | 368 | (Page 369) | 370 | 371 | .... | 413 | newer