Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter shivampaw

    (@shivampaw)

    I disabled all the plugins and tried the default 2019 theme but it still isn’t saving my posts.

    Thread Starter shivampaw

    (@shivampaw)

    Is there a way to do this without affecting what visitors see?

    I’m receiving a spam email every minute! This is bad, very bad!

    Trying Askimet now but really need option to use V2!

    I also have this issue. Any ideas on what’s going on? For now I have just had to disable recaptcha on my form.

    Thread Starter shivampaw

    (@shivampaw)

    I’m a dare devil!

    Got it working by following this: https://mathiasbynens.be/notes/mysql-utf8mb4

    Thanks for the guidance and help ??

    Thread Starter shivampaw

    (@shivampaw)

    Not working.

    show variables like “character_set_database”;
    shows “utf8mb4”

    My tables encoding is utf8mb4
    My tables collation is utf8mb4_unicode_ci

    WP-CONFIG.PHP has:

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8mb4');
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    Which causes the same initial problem. Changing it to utf8 works again.

    my.cnf has the following in the mysqld section

    
    default-storage-engine=InnoDB
    
    innodb-file-format=barracuda
    innodb-file-per-table=true
    innodb-large-prefix=true
    
    collation-server=utf8mb4_unicode_ci
    character-set-server=utf8mb4
    

    Any ideas?

    Thread Starter shivampaw

    (@shivampaw)

    Thanks! I’ll use that today to get it working with utf8mb4.

    Thanks ??

    Thread Starter shivampaw

    (@shivampaw)

    I think WordPress seems to use utf8mb4 automatically and then when I switched DataBases I used utf8 so that probably caused the problem.

    Thread Starter shivampaw

    (@shivampaw)

    I fixed both of these by changing

    define(‘DB_CHARSET’, ‘utf8mb4’); in WP-CONFIG.php

    to

    define(‘DB_CHARSET’, ‘utf8’);

    Thread Starter shivampaw

    (@shivampaw)

    Just tried both but no luck. The post content is still blank. The pages show the content fine though which means it’s in the database. It’s just not showing in the backend.

    It worked fine on the development domain.

    Thread Starter shivampaw

    (@shivampaw)

    Anyway. I have just reverted to http for now.

    Thread Starter shivampaw

    (@shivampaw)

    Thread Starter shivampaw

    (@shivampaw)

    Hi,

    I already tried to define('WP_MEMORY_LIMIT','512M');

    For the php.ini
    Will it be loaded if it’s in the /wp-admin directory?

    Also I checked phpinfo and it said it is currently set to 512M

    Thread Starter shivampaw

    (@shivampaw)

    I have fixed the breadcrumb issues by pasting this into my functions.php

    add_filter( 'wpseo_breadcrumb_single_link', 'link_to_last_crumb' , 10, 2); 
    
    function link_to_last_crumb( $output, $crumb){     
    
    	$output = str_replace('<strong class="breadcrumb_last">'.$crumb['text'].'</strong>', '<span rel="v:child" typeof="v:Breadcrumb"><a href="'.$crumb['url'].'" rel="v:url" property="v:title">'.$crumb['text'].'</a></span>', $output);
    
        return $output;
    }

    I now get all breadcrumb items showing in Google’s rich snippet tester.

    Thread Starter shivampaw

    (@shivampaw)

    I have managed to get the Article (BlogPosting) Schema.Org workingg.

    Paste this in a file called “json-ld.php” (You will probs need to create it.)

    <?php
    function get_post_data() {
      global $post;
      return $post;
    }
    
    function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches[1][0];
    
      if(empty($first_img)) {
        $first_img = "ENTER A DEFAULT IMAGE HERE";
      }
      return $first_img;
    }
    
    function word_count() {
        $content = get_post_field( 'post_content', $post->ID );
        $word_count = str_word_count( strip_tags( $content ) );
        return $word_count;
    }
    
    function comma_tags($tags, $show_links = true)
    {
      if($tags)
      {
        $t = array();
        foreach($tags as $tag)
        {
          $t[] = (!$show_links) ? $tag->name : '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
        }
        return implode(", ", $t);
      }
      else
      {
        return false;
      }
    }
    
    // stuff for any page
    $payload["@context"] = "https://schema.org/";
    
    // this has all the data of the post/page etc
    $post_data = get_post_data();
    
    // stuff for any page, if it exists
    $category = get_the_category();
    
    // stuff for specific pages
    if (is_single() || is_singular()) {
      // this gets the data for the user who wrote that particular item
      $author_data = get_userdata($post_data->post_author);
      $post_url = get_permalink();
      $post_thumb = get_post_thumbnail_id($post->ID);
    
      $payload["@type"] = "BlogPosting";
      $payload["url"] = $post_url;
      $payload["author"] = array(
          "@type" => "Person",
          "name" => $author_data->display_name,
          );
      $payload["headline"] = $post_data->post_title;
      $payload["datePublished"] = get_the_date("Y-m-d");
      $payload["datePublished"] = get_the_date("Y-m-d");
      $payload["dateModified"] = get_the_modified_date("Y-m-d");
      $payload["wordCount"] = word_count();
      $payload["creator"] = array(
          "@type" => "Person",
          "name" => $author_data->display_name,
          );
      $payload["keywords"] = comma_tags(get_the_tags(), false);
    
      $img_url = catch_that_image();
    
    	$imgdata = getimagesize($img_url);
    	$width = $imgdata[0];
    	$height = $imgdata[1];
    
      $payload["image"] = array(
    	  "@type" => "ImageObject",
    	  "url" => $img_url,
    	  "height" => $height,
    	  "width" => $width
      );
    
      $payload["mainEntityOfPage"] = array(
    		"@type" => "WebPage",
    		"@id" => $post_url
      );
    
      $payload["ArticleSection"] = $category[0]->cat_name;
      $payload["Publisher"] =
      			array(
    	  			"@type" => "Organization",
    	  			"name" => "ENTER ORGANIZATION NAME",
    	  			"logo" => array(
    		  			"@type" => "ImageObject",
    		  			"url" => "ENTER ORGANIZATION LOGO"
    		  		)
      			);
    }
    
    if (is_front_page()) {
      $payload["@type"] = "Organization";
      $payload["name"] = "Depression For Teens";
      $payload["logo"] = "ENTER ORGANIZATION LOGO HERE";
      $payload["url"] = "ENTER YOUR URL HERE";
      $payload["sameAs"] = array(
        "https://twitter.com/xxxxxxxxxxxxxxx",
        "https://www.facebook.com/xxxxxxxxxxxxxxx",
        "https://plus.google.com/xxxxxxxxxxxxxxx"
      );
      $payload["contactPoint"] = array(
        array(
          "@type" => "ContactPoint",
          "telephone" => "xxxxxxxxxxxxxxx",
          "email" => "xxxxxxxxxxxxxxx"
        )
      );
    }
    
    if (is_author()) {
      // this gets the data for the user who wrote that particular item
      $author_data = get_userdata($post_data->post_author);
    
      // some of you may not have all of these data points in your user profiles - delete as appropriate
      // fetch twitter from author meta and concatenate with full twitter URL
      $twitter_url =  " https://twitter.com/";
      $twitterHandle = get_the_author_meta('twitter');
      $twitterHandleURL = $twitter_url . $twitterHandle;
    
      $websiteHandle = get_the_author_meta('url');
    
      $facebookHandle = get_the_author_meta('facebook');
    
      $gplusHandle = get_the_author_meta('googleplus');
      $payload["@type"] = "Person";
      $payload["name"] = $author_data->display_name;
      $payload["email"] = $author_data->user_email;
      $payload["sameAs"] =  array(
        $twitterHandleURL, $websiteHandle, $facebookHandle, $gplusHandle
    
          );
    
    }

    You will need to handle the customisations EG (Oragnization details etc.) but that should work.

    After you have made that file place the following before the </head> in the header.php file for your theme (preferably child theme)

    <?php include('json-ld.php'); ?>
    <script type="application/ld+json"><?php echo json_encode($payload); ?></script>

    I am still having issues with the breadcrumb though.

Viewing 15 replies - 1 through 15 (of 19 total)