more.than.obsidian
Forum Replies Created
-
Here is how the current functions.php looks:
Thanks for the very helpful tip, keesiemeijer! However, my site still crashes when I add this function into my functions.php. I get the following error:
“Server error 500:
The website encountered an error while retrieving https://www.ABC.com/wp-admin/theme-editor.php?file=functions.php&theme=agama-child-theme&scrollto=100&updated=true. It may be down for maintenance or configured incorrectly.”Does it mean that I have a clash with something in my theme? Or is my function wrong?
Forum: Plugins
In reply to: [WP Page Title With Icon] Use Emoji instead of Font AwesomeOkay, I was able to display icons or emojis in front of the title by using custom fields and changing some php files in the theme.
In the custom fields of posts or pages, create a custom field with the name of
title-icon-tag
(this name can be changed to how you like it)
and with the value as
<img src="https://ABC.com/icon01.png"/>
.Go to the loop.php file in the theme, add this code:
<?php echo get_post_meta($post->ID, 'title-icon-tag', true); ?>
before the<?php the_title(); ?>
.
This shows the icon in front of the title in the latest posts page.Go to the single.php file in the theme, add same code above before the
<?php the_title(); ?>
.
This shows the icon in front of the title in the single posts page.The bad side of this code is that this will be removed after each update. I’m not so sure how to do this in the child theme. This is the downside to the code but it is functioning well.
The img URL can be replaced with an emoji. Simply copy-paste from a list of emoji into the value field. Using this meta also makes sure that the emoji does not go into the tab name.
Hello jerryscg,
thank you so much for your swift answer and a hint of where the files are located. This is really helpful. I was also not aware that this is a bad practice trying to insert the image in the title. I want to try to keep the alt attribute in the images so that the search engines can still find my image acc. to my post content, so I have come up with a manual fix using meta:
In the custom fields of posts or pages, create a custom field with the name of
title-icon-tag
(this name can be changed to how you like it)
and with the value as
<img src="https://ABC.com/icon01.png"/>
.Go to the loop.php file, line 27, add this code:
<?php echo get_post_meta($post->ID, 'title-icon-tag', true); ?>
before the<?php the_title(); ?>
.
This shows the icon in front of the title in the latest posts page.Go to the single.php file, line 8, add same code above before the
<?php the_title(); ?>
.
This shows the icon in front of the title in the single posts page.The bad side of this code is that this will be removed after each update. I’m not so sure how to do this in the child theme. This is the downside to the code but it is functioning well.
The img URL can be replaced with an emoji. Simply copy-paste from a list of emoji into the value field.
Forum: Fixing WordPress
In reply to: Imported images shown as gray thumbnails – URL is correctThe media library now looks like this:
https://ppt.cc/9siSlForum: Fixing WordPress
In reply to: Webhost does not offer phpMail() – Alternatives?@jason Hendriks:
P.S. My friend also suggested me Openshift and it seemed like a very stable free host. However, it is a nightmare for absolute beginners with no background knowledge to programming or git. It would be a good choice for me should I ever figure out how git works ??Forum: Fixing WordPress
In reply to: Webhost does not offer phpMail() – Alternatives?@jason Hendriks:
Thank you so much for the suggestion of your plugin Postman SMTP! It worked wonderfully and I can successfully bypass the phpMail()!! Thank you so much for the great plugin and it’s definitely a keeper for me!@wptweaks, @liquid-web-design-london:
Thank you as well for your suggestions. I had been staying away from paid hosting services because almost all of them cost more than my planned budget for a blog just for fun. (I was thinking less than 15€ a year)
But I was not aware that there’s an option being £12 a year, and I passed by some comments of users saying that my current free web hosting service sometimes cut down people’s blogs for no clear reason… So thanks for the suggestion, I have signed up for one year in The Path hosting to try it out. I hope it works fine ??My site is currently set to
echo substr( $content, 0, 500 )
if you would like to see how it looks like.Thank you so much for helping me locate this line of code!!
The code
<?php the_content(); ?>
worked wonderfully and recognized all the line breaks.The second code,
<?php
$content = get_the_content();
echo substr( $content, 0, 100 );
?>
, had however ignored the line breaks again.
Is it possible to keep the line breaks with the second code?Also, is it possible to set this echo code to fetch the first 5 lines or the first 2 paragraphs?
(I suppose this is more of a coding question…..)Sorry, I was tweaking a little bit the php data and the theme crashed as a result. Now the site should be functioning again.
And thanks for the quick reply! When would probably the next theme update happen? (Or are there any quick fixes I can do to my theme so that my blog can go online in the next few days?)
Thank you!