Scroll box

Dreamgrow Scroll Triggered Box
https://wordpress.org/…iggered-box/

The box is designed to get the attention of the visitors who have engaged with your site. The box triggers on certain event you specify, such as percentage of scroll, reaching an end of the post or comments. This verifies that visitors are engaged with the content and presenting them with a call-to-action.

What do you get with this plugin?

  • Getting more subscribers to your newsletter
  • Making people share your posts
  • Driving visitors deeper with related posts
  • Filling out a contact form
  • Displaying best offers
  • Set the amount of days for the box to stay hidden if visitor closes it
  • Design templates to save you time with the appearance of the box
  • Fully customization if you want to use your own design (HTML and CSS)
  • Control the position of the box (pages, posts, frontpage, left, right)
  • When to trigger the box (% of scroll, specific element)

Alternativa

Scroll Triggered Boxes
https://wordpress.org/…gered-boxes/

  • subscribing to your newsletter
  • sharing a post
  • submitting a contact form
  • or something entirely different, you decide!

Really anything is possible, from social media sharing options to sign-up or contact forms. The plugin is designed to work with any other plugin that uses shortcodes.

Přidání nového příspěvku programátorsky

/*
A function used to programmatically create a post in WordPress.
@returns -1 if the post was never created, -2 if a post with the same title exists, or the ID of the post if successful.
*/

function programmatically_create_post($user_id) {
        // Initialize the page ID to -1. This indicates no action has been taken.
        $post_id = -1;

        // Setup the title of the post
        $title = 'My New Post'

        // If the page doesn't already exist, then create it
        if( null == get_page_by_title($title)) {
                // Set the post ID so that we know the post was created successfully
                $new_post = array(
                'post_title' => $title,
                'post_name' => my-new-post,
                'post_content' => 'Lorem ipsum dolor sit amet...',
                'post_status' => 'publish',
                'post_date' => date('j.n.Y H:i:s'),
                'post_author' => $user_id,
                'post_type' => 'post',
                'post_category' => array(0),
                'comment_status'  => 'closed',
                'ping_status'   => 'closed',
                );
                $post_id = wp_insert_post($new_post);
        // Otherwise, we'll stop
        } else {
                // Arbitrarily use -2 to indicate that the page with the title already exists
                $post_id = -2;
        } // end if
} // end programmatically_create_post

Programmatically Create a Post in WordPress »
How to Create a Post in WordPress Programmatically » to Create a Post in WordPress Programmatically

To lze využít např. pro automatické vytvoření příspěvku z uživatelského profilu při jeho ukládání přes user_register hook:

add_action('user_register','programmatically_create_post');

Jak přidat tlačítko do HTML editoru

// Add buttons to html editor
add_action('admin_print_footer_scripts','eg_quicktags');
function eg_quicktags() {
?>
<script type="text/javascript" charset="utf-8">
/* Adding Quicktag buttons to the editor WordPress ver. 3.3 and above
* - Button HTML ID (required)
* - Button display, value="" attribute (required)
* - Opening Tag (required)
* - Closing Tag (required)
* - Access key, accesskey="" attribute for the button (optional)
* - Title, title="" attribute (optional)
* - Priority/position on bar, 1-9 = first, 11-19 = second, 21-29 = third, etc. (optional)
*/
QTags.addButton( 'eg_paragraph', 'p', '<p>', '</p>', 'p' );
QTags.addButton( 'eg_pre', 'pre','<pre lang="php">', '</pre>', 'q' );
</script>
<?php
}

Manipulace s údaji v Contact Form 7 před a po odeslání

WordPress Contact Form 7 Hook Unofficial Developer Documentation and Examples »

Changing Form Data Before it is Saved »

Contact Form 7 - form submit change field value »

How to create a mail counter for Contact Form 7 »

Extending the Contact Form 7 Plugin »

[private]

### příklad použitý na http://u904.cz/mimoradna-nabidka-lifebook-a512/
### pocitadlo objednavek odeslanych z CF7

// Define the key to store in the database
define('CF7_COUNTER', 'cf7-counter');
define('CF7_LASTORD', 'cf7-lastord');
define('POCNAB', '200'); // startovni pocet kusu

### Create the shortcode which will read the value from db option
function cf7db_reader(){
        $val = get_option(CF7_COUNTER, POCNAB);  // kdyz neexistuje option v db, vrati startovni pocet
        return $val;
}
add_shortcode('CF7_show', 'cf7db_reader');


### Action performed BEFORE the mail is sent by CF7
function wpcf7_change_mail($form) {
        $formid = $form->id; // gets current form id
        if ($formid == '384') {
          $wpcf7 = WPCF7_ContactForm::get_current(); // get current FORM instance
                $wpcf7data = WPCF7_Submission::get_instance(); // // get current SUBMISSION instance
                if ($wpcf7data) {
                        $formData = $wpcf7data->get_posted_data();
                }
                // Reading a posted value in the form with PHP
                $poc = $formData['pocet']; // nacte hodnotu z prave odeslaneho formulare
                $val = get_option(CF7_COUNTER, POCNAB); // nacte aktualni hodnotu skladu, kdyz neexistuje option v db, vytvori a naplni ji startovnim poctem objednavku.

                // nahrada dat v mailu
                $mail = $wpcf7->prop('mail');

                if($poc > $val): // objednano vic kusu, nez je na sklade, nahradim REPLACER textem
                        $mail['pocet'] = $val; // snizim objednany pocet
                        // doplnim upozorneni do mailu
                        // Find/replace the "special" tag as defined in your CF7 email body
        $mail['body'] = str_replace('REPLACER', "Jelikož jste objednali větší počet (".$poc." ks), než bylo aktuálně k dispozici skladem (".$val." ks), bude objednaný počet snížen na dostupné množství.\n", $mail['body']);
                else: // odstrani REPLACER string
                        $mail['body'] = str_replace('REPLACER', "", $mail['body']);
                endif;

    // Save the email body
    $wpcf7->set_properties(array("mail" => $mail));

                // return current cf7 instance
    return $wpcf7;
        }
}
add_action('wpcf7_before_send_mail', 'wpcf7_change_mail');


### Action performed WHEN the mail is sent by CF7
function cf7_decrement_order_counter($form){
        $formid = $form->id; // gets current form id
        if ($formid == '384') {
          // $wpcf7 = WPCF7_ContactForm::get_current(); // get current FORM instance
                $wpcf7data = WPCF7_Submission::get_instance(); // // get current SUBMISSION instance
                if ($wpcf7data) {
                        $formData = $wpcf7data->get_posted_data();
                }
    $poc = $formData['pocet']; // nacte hodnotu z prave odeslaneho formulare
    $val = get_option(CF7_COUNTER, POCNAB) - $poc; // kdyz neexistuje option v db, vytvori a naplni ji startovnim poctem snizenym o odeslanou objednavku.
                update_option(CF7_COUNTER, $val); // Update the settings with the new count
                update_option(CF7_LASTORD, $poc); // Update the settings with the new count
        }
}
add_action('wpcf7_mail_sent', 'cf7_decrement_order_counter');


### zmena poctu objednanych kusu v databazi odeslanych formularu (Contact Form DB)
function change_cfdb_value($formData){
        $formName = 'A514';
        if ($formData && $formName == $formData->title) {
                $poc = $formData->posted_data['pocet'];
                $val = get_option(CF7_COUNTER, POCNAB);
                if($poc > $val): // objednano vic kusu, nez je na sklade
                        $formData->posted_data['dodavka'] = $val;
                else:
                        $formData->posted_data['dodavka'] = $poc;
                endif;
  }
  return $formData;
}
add_filter('cfdb_form_data', 'change_cfdb_value');


### Change content of Ordering Page
function formRemover($content) {
                if(!is_feed() && !is_admin() && is_page(381)) {
        $val = get_option(CF7_COUNTER);
        if($val == 0):
                                $content = str_replace('<h3>Tak neváhejte!</h3>', '<h3>Prodej byl ukončen.</h3>', $content);
        else:
                                $content = str_replace('</ul>', '</ul><h3>Objednávkový formulář</h3><h3></h3>[contact-form-7 404 "Not Found"]', $content);
                        endif;
    }
    return $content;
}
add_filter ('the_content', 'formRemover');


### Change content of Thank You Page
function orderAlert($content) {
                if(!is_feed() && !is_admin() && is_page(385)) {
        $val = get_option(CF7_COUNTER, POCNAB);
        $poc = get_option(CF7_LASTORD, 0);
        $roz = $poc-$val;
        if($val <= 0):
                                $content = str_replace('REPLACER', '<h3>Díky za objednávku.</h3><p>Jelikož jste objednali <b>větší počet</b> kusů, než bylo aktuálně k dispozici skladem, byl Vámi objednaný počet <b>snížen</b>.</p><p>Na adresu, kterou jste uvedli ve formuláři, byl zaslán potvrzující e-mail.</p>', $content);
                                update_option(CF7_COUNTER, 0); // vynulovani pocitadla
                                update_option(CF7_LASTORD, 0); // vynulovani pocitadla
        else:
                                $content = str_replace('REPLACER', '<h3>Díky za objednávku.</h3><p>Na adresu, kterou jste uvedli ve formuláři, byl zaslán potvrzující e-mail.</p>', $content);
                        endif;
    }
    return $content;
}
add_filter ('the_content', 'orderAlert');


### pridani odkazu na blog page k excerptum
function excerpt_read_more_link($output) {
global $post;
return $output . '<a href="'. get_permalink($post->ID) . '"> Více »</a>';
}
add_filter('the_excerpt', 'excerpt_read_more_link');


#############################
#### ve starších verzích CF7
#############################

// Define the key to store in the database
define('CF7_COUNTER', 'cf7-counter');
define('CF7_LASTORD', 'cf7-lastord');
define('POCNAB', '260'); // startovni pocet kusu

### Create the shortcode which will read the value from db option
function cf7db_reader(){
        $val = get_option(CF7_COUNTER, POCNAB);  // kdyz neexistuje option v db, vrati startovni pocet
        return $val;
}
add_shortcode('CF7_show', 'cf7db_reader');


### Action performed BEFORE the mail is sent by CF7
function wpcf7_change_mail($formData) {
        $formName = 'A512';
        if ($formData && $formName == $formData->title) {
                // Reading a posted value in the form with PHP
                $poc = $formData->posted_data['pocet']; // nacte hodnotu z prave odeslaneho formulare
                $val = get_option(CF7_COUNTER, POCNAB); // nacte aktualni hodnotu skladu, kdyz neexistuje option v db, vytvori a naplni ji startovnim poctem objednavku.
                $bod = $formData->mail['body'];

                if($poc > $val): // objednano vic kusu, nez je na sklade, nahradim REPLACER textem
                        $formData->posted_data['pocet'] = $val; // snizim objednany pocet
                        // doplnim upozorneni do mailu
                        $bod = str_replace('REPLACER', "Jelikož jste objednali větší počet (".$poc." ks), než bylo aktuálně k dispozici skladem (".$val." ks), byl objednaný počet snížen na dostupné množství.\n", $bod);
                        $formData->mail['body'] = $bod;
                else: // odstrani REPLACER string
                        $bod = str_replace('REPLACER', '', $bod);
                        $formData->mail['body'] = $bod;
                endif;
        }
}
add_action('wpcf7_before_send_mail', 'wpcf7_change_mail');


### Action performed WHEN the mail is sent by CF7
function cf7_decrement_order_counter($formData){
        $formName = 'A512';
        if ($formData && $formName == $formData->title) {
    $poc = $formData->posted_data['pocet']; // nacte hodnotu z prave odeslaneho formulare
    $val = get_option(CF7_COUNTER, POCNAB) - $poc; // kdyz neexistuje option v db, vytvori a naplni ji startovnim poctem snizenym o odeslanou objednavku.
                update_option(CF7_COUNTER, $val); // Update the settings with the new count
                update_option(CF7_LASTORD, $poc); // Update the settings with the new count
        }
}
add_action('wpcf7_mail_sent', 'cf7_decrement_order_counter');


### zmena poctu objednanych kusu v databazi odeslanych formularu (Contact Form DB)
function change_cfdb_value($formData){
        $formName = 'A512';
        if ($formData && $formName == $formData->title) {
                $poc = $formData->posted_data['pocet'];
                $val = get_option(CF7_COUNTER, POCNAB);
                if($poc > $val): // objednano vic kusu, nez je na sklade
                        $formData->posted_data['dodavka'] =     $val;
                else:
                        $formData->posted_data['dodavka'] =     $poc;
                endif;
  }
  return $formData;
}
add_filter('cfdb_form_data', 'change_cfdb_value');


### Change content of Ordering Page
function formRemover($content) {
                if(!is_feed() && !is_admin() && is_page(60)) {
        $val = get_option(CF7_COUNTER);
        if($val == 0):
                                $content = str_replace('<h3>Tak neváhejte!</h3>', '<h3>Prodej byl ukončen.</h3>', $content);
        else:
                                $content = str_replace('</ul>', '</ul><h3>Objednávkový formulář</h3><h3></h3>[contact-form-7 404 "Not Found"]', $content);
                        endif;
    }
    return $content;
}
add_filter ('the_content', 'formRemover');


### Change content of Thank You Page
function orderAlert($content) {
                if(!is_feed() && !is_admin() && is_page(72)) {
        $val = get_option(CF7_COUNTER, POCNAB);
        $poc = get_option(CF7_LASTORD, 0);
        $roz = $poc-$val;
        if($val <= 0):
                                $content = str_replace('REPLACER', '<h3>Díky za objednávku.</h3><p>Jelikož jste objednali <b>větší počet</b> kusů, než bylo aktuálně k dispozici skladem, byl Vámi objednaný počet <b>snížen</b>.</p><p>Na adresu, kterou jste uvedli ve formuláři, byl zaslán potvrzující e-mail.</p>', $content);
                                update_option(CF7_COUNTER, 0); // vynulovani pocitadla
                                update_option(CF7_LASTORD, 0); // vynulovani pocitadla
        else:
                                $content = str_replace('REPLACER', '<h3>Díky za objednávku.</h3><p>Na adresu, kterou jste uvedli ve formuláři, byl zaslán potvrzující e-mail.</p>', $content);
                        endif;
    }
    return $content;
}
add_filter ('the_content', 'orderAlert');

[/private]

Ve verzi CF7 4 a vyšší se způsob přebírání dat z formuláře změnil:

/* WPCF7_ContactForm object no longer has a posted_data property. */
$posted_data = $contact_form->posted_data; // Tohle už nefunguje

/* Use WPCF7_Submission object's get_posted_data() method to get it. */
$submission = WPCF7_Submission::get_instance();

if ( $submission ) {
    $posted_data = $submission->get_posted_data();
}

Ochrana e-mailu před roboty

CryptX
http://wordpress.org/plugins/cryptx/

No more SPAM by spiders scanning you site for email adresses. With CryptX you can hide all your email adresses, with and without a mailto-link, by converting them using javascript or UNICODE. You can choose to add a mailto-link to all unlinked email adresses with only one klick at the settings.

*

There is also a core WordPress function for it: antispambot().
The usage of the function is pretty simple:

<?php
$my_email_address = "my.secret.email.address@gmail.com";
$my_email_address_cloaked = antispambot( $my_email_address );
echo $my_email_address_cloaked;
?>

But you can't use PHP in your content (unless you're using a plugin for that purpose). To use this function in your content, you can utilize a cool little shortcode like the one below. By using the shortcode above, you can cloak email addresses anywhere in your posts.

<?php
function antispambot_sc( $atts ) {
    extract( shortcode_atts( array(
        'email' => ''
    ), $atts ) );
    return antispambot( $email );
}
add_shortcode( 'antispambot', 'antispambot_sc' );
// Usage: [antispambot email="my.cloaked.email.address@gmail.com"]
?>

*

případně

function cwc_mail_shortcode( $atts , $content=null ) {
    for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';';
    return '<a href="mailto:'.$encodedmail.'">'.$encodedmail.'</a>';
}
add_shortcode('mailto', 'cwc_mail_shortcode');

Použití shortcode:

[mailto]email@y­ourdomain.com[/ma­ilto]

Whiteboard framework

Whiteboard framework for WordPress was developed to speed up the development of WordPress themes. Whiteboard does so by eliminating the time spent on code common to all WordPress themes and includes non-intrusive code that improves the overall WordPress theme in many ways - including SEO, speed, usability, mobile support, and multi-lingual support.

Whiteboard is not like most other WordPress Frameworks out there. While most other WordPress Frameworks include a mess of styles, functions, and content areas that have to be cleaned out for nearly every project, Whiteboard remains a true WordPress Framework. Whiteboard includes only the core WordPress structure and does not get fancy with unnecessary functions. While Whiteboard does include Less Framework and a minimal theme.

WordPress návody přímo v administraci

LifeGuard+
http://wplifeguard.com/…uard-plugin/

The LifeGuard+ Assistant plugin puts WordPress video tutorials right into a WordPress Dashboard. Gone are the days where WordPress developers have to teach each new client how to use WordPress. Now all that needs to be done is install LifeGuard+ Assistant on all new client WordPress projects, and they can learn how to use WordPress by watching our thorough WordPress tutorials!