shivampaw
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Guttenburg editor not savingI disabled all the plugins and tried the default 2019 theme but it still isn’t saving my posts.
Forum: Fixing WordPress
In reply to: Guttenburg editor not savingIs there a way to do this without affecting what visitors see?
Forum: Plugins
In reply to: [Contact Form 7] reCAPTCHA V3 allowing spamI’m receiving a spam email every minute! This is bad, very bad!
Trying Askimet now but really need option to use V2!
Forum: Plugins
In reply to: [Contact Form 7] Still Uncaught TypeError with ReCaptcha + CF7I also have this issue. Any ideas on what’s going on? For now I have just had to disable recaptcha on my form.
Forum: Fixing WordPress
In reply to: Changing URL ProblemI’m a dare devil!
Got it working by following this: https://mathiasbynens.be/notes/mysql-utf8mb4
Thanks for the guidance and help ??
Forum: Fixing WordPress
In reply to: Changing URL ProblemNot working.
show variables like “character_set_database”;
shows “utf8mb4”My tables encoding is utf8mb4
My tables collation is utf8mb4_unicode_ciWP-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?
Forum: Fixing WordPress
In reply to: Changing URL ProblemThanks! I’ll use that today to get it working with utf8mb4.
Thanks ??
Forum: Fixing WordPress
In reply to: Changing URL ProblemI think WordPress seems to use utf8mb4 automatically and then when I switched DataBases I used utf8 so that probably caused the problem.
Forum: Fixing WordPress
In reply to: Changing URL ProblemI fixed both of these by changing
define(‘DB_CHARSET’, ‘utf8mb4’); in WP-CONFIG.php
to
define(‘DB_CHARSET’, ‘utf8’);
Forum: Fixing WordPress
In reply to: Changing URL ProblemJust 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.
Forum: Plugins
In reply to: [YouTube WordPress Plugin by Embed Plus] SSL Not WorkingAnyway. I have just reverted to http for now.
Forum: Plugins
In reply to: [YouTube WordPress Plugin by Embed Plus] SSL Not WorkingGives a certificate error. That page is loaded with your JS.
Forum: Fixing WordPress
In reply to: High Memory AllocationHi,
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
Forum: Plugins
In reply to: [Yoast SEO] Structured Data and Rich Snippets ProblemsI 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.
Forum: Plugins
In reply to: [Yoast SEO] Structured Data and Rich Snippets ProblemsI 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.