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 | .... | 389 | 390 | (Page 391) | 392 | 393 | .... | 413 | newer

    0 0

    Hi, people,

    To be short: At some stage after installing, configuring W3TC and Autoptimizer plugins i have noticed the following error while inspecting pages:
    Uncaught TypeError: c.hoverIntent is not a function... (it is javascript allowing images to slide, fade)

    Tried uninstall, reconfigure plugins one by one and all together - in vain.
    Interestingly, if i go to another page in browser and then come back to this with error - all is normal and working.

    I am not a programmer/developer.
    Any help?

    0 0

    You would not believe the amount of trouble I have had these past few days, I now understand the phrase: "5% of the time is spent doing 95% of the work, 95% is spent on the last 5%".

    I am trying frantically (needs to be done in the next week or so) to get anything working, and I can worry about neatening it up later, but I have been having huge trouble doing even that.

    I am trying to use wp_mail to send an email with an attachment, but there are a few issues:
    1) The attachment does not appear
    2) I have to use the direct URL to send the email (not working on button)
    3) The variable names for dynamic text fro the email don't work.

    The code can be found below, this code covers the front-end display (added in with shortcode), and the "backend" stuff which supposedly sends the email.

    Just a heads up, a lot of this code is irrelevant to the issue(just trying to be thorough), this is the front-end bits(shortcoded bits):

    function file_download(){
        			.downloadHolder {
            				background: #181D25;
            				box-shadow: inset 0 0 42px 0 rgba(100,100,100,0.1);
            				margin: 0 0 2.5rem 0;
            				padding: 40px 40px;
            				text-shadow: 0 1px 1px #000000;
            				text-align: center;
        			.downloadBtn {
            				background-color: #005dac;
            				background-image: -webkit-linear-gradient(top,#0077b3,#0036a3 100%);
            				background-image: linear-gradient(to bottom,#0077b3,#0036a3 100%);
            				color: #fff;
            				text-decoration: none;
            				border-radius: 3px;
            				border: 1px solid;
            				box-shadow: inset 0 1px 0 rgba(255,255,255,0.22),0 1px 2px rgba(0,0,0,0.05);
            				text-shadow: 0 1px 0 rgba(0,0,0,0.5);
            				padding: .5rem 1rem;
            				font-size: 1.125rem;
        				border-color: #002a80 #002a80 #013013;
        				.downloadBtn:hover {
            					background-color: #006dcc;
            					background-image: -webkit-linear-gradient(top,#08c,#04c 100%);
            					background-image: linear-gradient(to bottom,#08c,#04c 100%);
            					border-color: #0036a3 #0036a3 #026;
        			.demoBtn {
            				background-color: #fafafa;
        	    			background-image: -webkit-linear-gradient(top,#fefefe,#f4f4f4 100%);
        				background-image: linear-gradient(to bottom,#fefefe,#f4f4f4 100%);
            				color: #333;
            				text-decoration: none;
            				border-radius: 3px;
            				border: 1px solid;
            				box-shadow: inset 0 1px 0 rgba(255,255,255,0.22),0 1px 2px rgba(0,0,0,0.05);
            				text-shadow: 0 1px 0 rgba(255,255,255,0.5);
            				padding: .5rem 1rem;
            				font-size: 1.125rem;
        				border-color: #e0e0e0 #e0e0e0 #c1c1c1;
        				.demoBtn:hover {
            					background-color: #ffffff;
            					background-image: -webkit-linear-gradient(top,#F3F3F3, #E1E1E1 100%);
            					background-image: linear-gradient(to bottom,#F3F3F3, #E1E1E1 100%);
            					border-color: #F3F3F3 #F3F3F3 #E1E1E1;
        			.emailInput	{
        				width: 100%;
        				height: 40px;
        				border-radius: 3px;
        				margin-top: 14px !important;
        				margin-bottom: 14px !important;
        global $post;
        $intro = get_post_meta($post -> ID, $key = 'podcast_file', true);
        $path = str_replace("","",$intro);
        		<div class="downloadHolder">
        			<p style="margin-bottom: 20px;">Please note: FTB files can only be used if you have Free The Blobs on Android or iOS.</p>
          			<a>" download="<?php echo basename($intro) ?>" class="demoBtn">Download for PC</a>
          			<!--<a href="#">Demo</a>-->
        			<input type="text" name="emailValue" id="emailValue" placeholder="Email Address" class="emailInput" style="text-align: center;">
        			<button onclick="emailsend();" class="downloadBtn" style="margin-top: 0px; width: 100%;">Email for Mobile</button>
        			<span>(We do NOT collect email addresses.)</span>
        			<script>function emailsend() {
        		    	email = document.getElementById('emailValue').value;
            			downloadurl = '<?php admin_url('admin-ajax.php'); ?>?action=download_email_send&postId=<?php echo $post->ID; ?>&emailValue='+email;
            			document.getElementById('emailsendframe').src = downloadurl;
        <!-- iframe for submitting to -->
        <iframe name="emailsendframe" id="emailsendframe" src="javascript:void(0);" style="display:none;"></iframe>
        echo WP_CONTENT_DIR . $path;
        return ob_get_clean();
        add_shortcode('level', 'file_download');'
    And this is the AJAX code to handle the actual sending of the emails:
        // note $_REQUEST will work with $_POST or $_GET methods
        function download_email_send() {
            $to = $_REQUEST['emailValue'];
            // preferably add some email address format validation here
            // $validate = some_email_validate_function($to);
            // if ($validated) {$message = 'Please check your email for typos.';}
            // else {
                $post_id = $_REQUEST['postID'];
                // ! you would need to redefine $intro here !
                $subject = 'Download for'.basename($intro);
                $msg = 'Your download for '.basename($intro).' is attached to this email.';
                $headers = 'From: Free The Blobs <>' . "\r\n";
                $mail_attachment = array(WP_CONTENT_DIR . $path,);
                $send = wp_mail($to, $subject, $msg, $headers, $mail_attachment);
                if ($send) {$message = 'Success! Check you email address.';}
                else {$message = 'Error: Mail sending failed.';}
            // }
            // alert the user to the result
            echo "<script>alert('".$message."');</script>";

    In order to get this to send an email at all, I have to use a URL to call it, and cannot use the button (I don't think it can get the email address from the input):

    You can see what this is doing wrong by putting your email in the "" bit at the end (we don't collect emails, don't worry :D).

    As you can see, the emails do not contain all the text information, and are missing the file attachment completely.

    What exactly am I doing wrong here?

    0 0

    I have 2 different websites installed on the same database. The 2 websites are sharing the users tables, but I want them to share the posts tables too. I tried to do it by editing wp-db.php. After this code:

    foreach ( $this->tables( 'global' ) as $table => $prefixed_table )
    $this->$table = $prefixed_table;

    I added this code:

    $this->posts = 'wp_posts';
    $this->postmeta = 'wp_postmeta';

    But it doesn't seems to work. How can I make the 2 websites use the same posts and postmeta tables?

    Thank you!

    0 0


    I have a secure site with admin behind a secure subnet. I am offloading media, assets to public S3 bucket using Offload S3 paid plugin. I have a read replica of the Admin DB that is connected to the customer facing WAF and EC2 servers.

    I would like to enable commenting for this site. Now that the customer facing site only has a read only database associated with it, I would like to see what options I have. How about we expose an API that takes comments and posts to a service that can write to the Admin database?

    Is there a better option?

    0 0

    Hello All,

    I have created a custom post type named "coupon" and wish to redirect any single post in this post type, which is in draft, to a new URL. I am using the following code but for some reason, it is not working.

    function redirect_scp() {
        if(!current_user_can('administrator')) {
        	global $post;
        	if( is_singular('coupon') ){
        		if ( $post->post_status == "draft") {
    				wp_redirect( '<url_to_redirect_to>', 301);
    add_action('wp', 'redirect_scp');

    Any help will be appreciated.
    Thanks in advance.

    0 0


    I'm building a theme and want to include a toggle form.
    Form is displayed onclick:

    <div id="header-search"><?php _e( 'Search', 'textdomain' ); ?></div>
    <form id="header-search-form" style="display:none"><?php get_search_form(); ?></form>
    $( "#header-search" ).click(function() {
    	$( "#header-search-form" ).toggle();

    Because I don't want to include .js in my php template files I want to replace it to a separate file and call it from my functions file:

    wp_enqueue_script( 'head-search', get_template_directory_uri() . '/js/head-search.js', array( 'jquery' ) );

    So I have created a .js file called 'head-search' and added it to my /js theme folder. It contains:

    jQuery(document).ready(function() {
    	$( "#header-search" ).click(function() {
    		$( "#header-search-form" ).toggle();

    Enqueue is loaded in my head but toggle doesn't work.

    I guess the .js should be adjusted for external use?


    0 0


    I'd like to allow duplicate comments on a site I'm creating (for system messages posted as comments). I've found a core hack (no thanks), an md5 workaround (prefer not to) and one person who offers a hook solution (yes, please).

    The hook solution is here:

    But it doesn't work. I put the line of code into my plugin and my theme (separately), but it doesn't do anything:


    Still get the duplicate comment error message. Can anyone point me in the direction of a fix, please?


    0 0

    I want to add a filter to the comment_notification_text to remove the included email part of the text and (if poss) the IP and host details.

    I've searched the net but all I can find is how to add the text to say, modify the footer of the email. I want to remove (or filter) the email from notifications.

    thank you in advance :)

    0 0

    Hi guys,

    I am wondering if there are ways to validate front end form besides WP nonce. I read on Codex that nonce shouldn't be used to validate form.

    Nonces should never be relied on for authentication or authorization, access control. Protect your functions using current_user_can(), always assume Nonces can be compromised.

    My form is on front end and every visitor can submit it. I am using only nonce currently but is it safe enough to validate form?


    0 0

    I made a function to remove certain submenu items in the admin dashboard using remove_submenu_page:

    $submenu = array(
        'tools.php' => 'tools.php', // Tools > Available Tools
        'options-general.php' => 'options-writing.php', // Settings > Writing
        'options-general.php' => 'options-discussion.php' // Settings > Discussion
    foreach ( $submenu as $main => $sub ) {
        remove_submenu_page( $main, $sub );

    All of items are hidden except for the Settings > Writing menu. It looks like it has to due with the fact that I am also hidding another submenu under Settings (Settings > Discussion), but I am not sure why it's being "skipped".

    I could just do the following which would fix this:

    remove_submenu_page( 'tools.php', 'tools.php' ); // Tools > Available Tools
    remove_submenu_page( 'options-general.php', 'options-writing.php' ); // Settings > Writing
    remove_submenu_page( 'options-general.php', 'options-discussion.php' ); // Settings > Discussion

    But I want to use the foreach method instead and to understand why this logic isn't working 100%. Any help is appreciated.

    0 0

    if I enter the following code in an article, (using the pre or code tags):

    if( !empty( $testx ) ) {
    $output = apply_filters( 'test_name_output', sprintf( '<h2 class="testx">%s</h2>', $testx ) );
    echo $output;

    part of this code is "converted" and I get the following result, screenshot:

    This problem occurs with any theme.
    Tried with WordPress 4.4.xx AND 4.5.xx, same problem

    Thanks for any help or suggestions.

    0 0

    Maybe some of you from the community could help me get past a dilemma I have over using AJAX in WP, which I have not done before.

    I am in the early stages of building a WP plugin for enabling a logged-in user of a WP site or blog to submit a short, simple form. For the sake of argument, values entered in the form will be the principal, the interest and monthly installment on the repayment of a bond.

    The idea here is to allow the user to inquire how long it will take (i.e. the number of installments) until the bond is paid off, depending on how big or small an installment she pays . This will be displayed as a response in a text area or box at the bottom of the form.

    Using this form she could then explore various scenarios by re-entering different installment amounts and re-submitting the form on each such change.

    If I were to build such a plugin in a simple, no-frills way, then each time the user will re-submit this form that will cause a re-load of the page or post in which it lives. Moreover, because of its small size, this plugged-in form will likely share room on a page or post with other content.

    So the conventional wisdom here would argue for me to add some Javascript and "ajaxify" my form, in order to reduce page reloading by refreshing the content of only the "number-of-remaining-installments" box with the result to be fetched by AJAX from the server. In theory this sounds good.

    But I have gathered from various sources that Admin-ajax.php can carry with it its own overheads. That being said and considering that the form with its supporting process will be relatively quite small / simple, would it not be over-kill for me to "ajaxify" my plugin?

    It is not as if there were dozens and dozens of different input values of the form which would need undergo repeated validations on a server to warrant the added complexity, that would come with Ajax in the mix.

    The counter view is of course, that if there were to be many different subscribers all using this plugin simultaneously, this could add significantly to the volume of traffic with the server.

    By the way, there would actually be more PHP work going on in the back-end than what I have indicated in my over-simplified example, which is why I would prefer avoid doing the calculation in the front-end with Javascript.

    As I am undecided due to my confusion over this issue of the trade-offs, I would really appreciate hearing your views and feedback on this.

    0 0

    In the Twenty Eleven Theme, there was a function: twentyeleven_posted_on. Would anyone happen to know what the exact Twenty Twelve equivalent is?

    Thank you!

    0 0

    Dear folks,

    I would like to sort the posts on the tag-pages alphabetically, but leave the sorting-order on the homepage unaltered.

    The function that I use now also alters the homepage sort-order.

    function my_post_queries( $query ) {
    	// not an admin page and is the main query
    	if ( !is_admin() && $query->is_main_query() ) {
    		//$query->set( 'posts_per_page', 5 );
    		$query->set( 'orderby', 'title' );
    		$query->set( 'order', 'ASC' );
    add_action( 'pre_get_posts', 'my_post_queries' );

    0 0

    Hi, looks I am missing something out, can someone please explain this to me. I want to create object inside __construct then call it in another method of that class?

    class MyPlugin {
      public function __construct() {
          require_once(sprintf("%s/templates/class-db.php", dirname(__FILE__)));
          $db = new Orders_DB();
      public static function activate() {

    not working of course, tried a lot of things, but guess I am missing some basic things here. Thanks!

    0 0

    Hi evryone,

    im doing a WordPress Plugin for editing different custom posttypes.

    right now everthing is working as it shell. till now! :)
    Now i need the possibility to set checkboxes, which can be saved an given out with checked or not checked (so you can see it was checked in past or not).

    Problem is i dont know how to set a value and read it out from the Database.

    anybody that can help?

    Best reagards

    0 0


    I have a problem with my website. For all custommer, not the totality, all dont viewing the add to cart with variable product. Me, i have tested explorer, chrome, mozilla, phone mobile and dont have this problem.

    By week, i have 5 to 10 demand for this.

    For example, a link with variation :

    My english is not perfect, but i am french ^^

    Thanks to all for checking my problem

    0 0

    I'm trying to follow this tutorial.
    But instead of using PDF I would like to use ZIP.

    I replaced this line:
    $supported_types = array('application/pdf');
    $supported_types = array('application/zip, application/x-compressed-zip');

    and even if I upload an actual ZIP file the error message still pops up.

    Here is a pastebin of my custom post type and meta box etc.

    I have tried to google the issue and tried to rephrase my questions the best way I can but I still have not found a solution :/

    It's clear I am no professional so people might suggest I use a plug-in but I would actually like to use my functions.php file instead of the plug-ins...

    Could anyone please point me in the right direction?
    All help appreciated !

    0 0

    In a previous template, I have a bit of code using a category array, and some conditional statements. I would like to do something similar with my current Template: Twenty Twelve (Child), but I'm not having much luck making it work.

    I would like to include this code in my content.php file:

    if ( in_category( array('Political Cartoons', 'Political Statements' ) )) {
    <?php the_time('F jS, Y') ?>
    elseif ( in_category( array('Scripture', 'Biblical', 'Biblical Resources', 'Quotes', 'Holidays/Anniversaries', 'Article', 'Political', 'Political Literature', 'Political Terms', 'Admin') )) {
    Posted by <?php the_author_posts_link(); ?> | <?php the_time('F jS, Y') ?>
    else {
    Written by <?php the_author_posts_link(); ?> | <?php the_time('F jS, Y') ?>

    The problem is, I'm not sure how to make all of the condition statements work correctly. If someone could help me tweak it so that it will work correctly, I would really appreciate it.

    0 0

    I'm looking for a hack to display custom taxonomies in the sidebar. I know there are quite a few plugins available for such but I was hoping to display only the top terms used for a certain taxonomy in the last say 90 days. Any help would be appreciated.

older | 1 | .... | 389 | 390 | (Page 391) | 392 | 393 | .... | 413 | newer