Welcome to WebmasterWorld Guest from 54.221.131.67

Forum Moderators: rogerd & travelin cat

Self-Hosted wordpress help. Scheduled headlines and exerts showing

Self hosted wordpress.org blog showing scheduled headlines and exerts

     
2:08 pm on Dec 24, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


My self hosted wordpress site shows the headline and exert of scheduled posts before the scheduled publishing date. When I click on the post, it takes me to the post but there's no content beyond the headline and a date (1st January 1970 - before I was born and certainly not the scheduled publishing date).

I want to remove the headlines and the exerts of the scheduled posts from the website but I'm not sure which part of the code in the blog.php I need to edit or even if that's where the problem is (the site was built for me) or whether or not it is in one of the files in the wp folder within my directory...

Id really appreciate the help.
2:14 pm on Dec 24, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 219
votes: 15


You'll need to provide more info. Are you doing these scheduled publish posts with a plugin? If you did not create the site, then you might consider going back to the dev who did.
2:52 pm on Dec 24, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Toronto, it's not that simple. The dev built the site and now it's out of his hands... Not very supportive, then again, they are a competitor so it's in their interest to do what I paid them to and nothing more.

The initial scheduled posts came from a Wordpress .xml file that I exported from my .wordpress.com powered blog.
The new posts are created in the Wordpress powered section of the wp-admin side of my site.

It's nothing to do with the settings on Wordpress or the WP-admin, I am certain the issue is within the code either in the blog.php file or the wp directory.
3:44 pm on Dec 24, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 219
votes: 15


Do you have a child theme? Did you insist that your WP dev use a child theme? If you hack your theme files and do not have a child theme, if and when the theme is updated your changes will get overwritten.

It sounds like you do not want to include these scheduled posts in your web site. That is the presentation of your data and therefore changes to your theme are required.

You might consider reading up on the Wordpress loop [codex.wordpress.org], the workflow that WP uses to publish.

Where is this blog.php you are asking about? I've looked on my site and do not see a blog.php in WP core.
4:04 pm on Dec 24, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Toronto, the blog.php is in the main directory (it's called Public_html), in there is all the pages; index.htm, contact.htm, etc. as well as blog.php

WP is a folder within the Public_html directory (I expect this is the Wordpress install).
4:45 pm on Dec 24, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 219
votes: 15


If you have blog.php in your public_html and you have your Wordpress install in the subdirectory called "WP", then the blog.php file is unconnected to your Wordpress install. This blog.php could be anything, including a different non-wordpress site.

Wordpress sites have an index.php, not an index.htm. Wordpress sites also do not have a contact.htm. If you have Wordpress in a subdirectory then the only Wordpress-related file you might have is a wp-config.php in public_html.

It looks like you have something external to Wordpress. What is the difference between http://example.com and http://example.com/wp/ ? They might be different. Or they might be the same.

It looks like you need some professional help.
7:03 pm on Dec 24, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Umm, that isn't very refreshing haha. I know that it is only the mydomain/blog which is connected to Wordpress, hence why I do have an index.htm etc.

So, I'm in my file manager now. Inside public_html/wp I have index.php, wp-blog-header.php, wp-config.php, wp-settings.php, there is also a Readme.html file that talks about Wordpress' 5 minute install. I think the wp is installed on the blog.php in the parent directory (I'm assuming public_html is the parent directory).

Has this cleared anything up? :)

(I also know that the servers are held by LCN, on their site they advertise wordpress hosting... looks like I'm paying my hosting company extra to piggyback off them haha)
7:54 pm on Dec 24, 2017 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:3565
votes: 197


The "public_html" directory is your root directory for domain purposes, there are directories above that one but most shared hosts set that as your root directory. If you visit your site at https://example.com or https://www.example.com you should be seeing your WP theme. (one or the other, not either URL) depending on the settings in your WP admin Settings file.

That is an unusual setup. Wordpress is set up in a subdirectory and uses rewrite to appear to be in the home directory. I have a WP install set up that way, but blog.php is not part of that setup, it may have been added by your developer for some function but it is not a standard WP file. There seems to be some confusion as to how these things fit together. It is in your best interest to read and learn more about WordPress to avoid common mistakes. The WordPress.org [wordpress.org]site has a big section to help people get started right.

TorontoBoy is correct that your customization should be done on a child theme so that updates don't overwrite your custom settings. WP updates every 4 - 8 weeks recently and it is important to keep your WP up to date. Most updates are security related, even when they introduce new features. Most updates do not require a theme update, but some core features may change and require a theme update as well.
11:35 pm on Dec 27, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


I'm not 100% what you mean by child theme. I'm a bit of an novice, I've been looking at some Wordpress.org documentation but I'll be honest, I'm struggling to understand a word of it.This is what you're dealing with here. I'm brand new to this, or might as well be. (Can you tell, I've never owned a website before? haha)

I've gone back to brutally studying the code in my website, an arduious process but so far, seems to be the most effective rather than reading about code (it looks very complicated to write but to read... it is much easier, a good place to start I think)

I've come across this:


<?php if ($blog_article) { ?>
<title>xyz site - <?php echo $blog_posts['title']; ?></title>
<meta name="description" content="<?php echo $blog_posts['excerpt']; ?>">
<?php } else { ?>
<title>xyz site</title>
<meta name="description" content="xyzsite">


Note: My website is not called XYZ Site, I took out identifying info because I received a polite heads up to let me know I had a habit of sharing code unedited which included links and whatnot, anyway, hopefully this is alright? (yes?)

Anyway, back to my point, this code is from the blog.php file in the main directory of my website (it is not from the wp folder). I'm looking at it and wondering whether it is basically saying;
 If there is a blog article published from xyz site, show (echo) the title and exert otherwise, show title with content. 


Only when you click through to the content, because it isn't yet published, there is nothing to show?

Would the code work still if I removed the if statement and if and else commands? Eg:

<?php { ?>
<title>xyz site</title>
<meta name="description" content="xyzsite">


^^ I don't think that would work. It doesn't make sense. I think the if statement needs to be there, perhas it's the else statement that is the issue?


*Edit*
OK, I gave it a whirl and tried editing a few things, I'm not sure it is anything to do with that... Is there a way to add an "unless" statement? For example;

if ($blog_post) ...
unless...
else...
unless...

That way, we could use the unless command to make it so that if the post is scheduled, don't show the title exert or description.
(I think the else statement refers to whether or not there is an exert, if not, display the description instead, I might be wrong)
If this is possible, how would I write the command into the code (displayed in the first code tags in this message)?
11:54 pm on Dec 27, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 219
votes: 15


You have your WP core code, your plugins and your theme. Don't hack your core code as you might introduce a vulnerability or break WP. If you do hack core when WP auto-updates your changes will be overwritten.

Similarly you have your theme, which maybe from WP.org or 3d party. This can also be updated by the theme author. If you hack this theme and you then get an update the update will overwrite your changes. A child theme [developer.wordpress.org][url][/url] tells WP that you have theme changes to a specific base theme. The base theme can be updated and will not destroy your changes, which are done on your child theme. If you hack the base theme and do not update, the theme author might plug a vulnerability with a theme update, which you may not install. This will increase your risk.

Look at your .htaccess. WP does some rewrites and redirects here and might give you a clue. Maybe the original dev has hacked the htaccesss file.
12:41 am on Dec 28, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^(.+?)/do-not-touch.php do-not-touch.php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.htm -f
RewriteRule ^(.+?)/?$ $1.htm [L]

RewriteRule ^blog/([0-9-]+)/?$ blog.php?page=$1
RewriteRule ^blog/([A-Za-z0-9-]+)/?$ blog.php?slug=$1



I haven't a clue what that means...
12:56 am on Dec 28, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 219
votes: 15


Standard Wordpress .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
1:50 am on Dec 28, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


But what does it mean? I notice there are three key differences.

What is
Options +FollowSymLinks -MultiViews
?

The rewrite rule "Do Not Touch" is a configuration file between my blog and the server my website is hosted on.

The rewrite rule /blog.php is the blog page on my site.
1:51 am on Dec 28, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Also, what does the htaccess actually do? What's it's purpose?
3:15 am on Dec 28, 2017 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:3565
votes: 197


The .htaccess file is instructions for your server. It is not as forgiving as CSS, you should not edit it without an understanding of the proper syntax. The consequences of errors can make the site inaccessible.
3:50 am on Dec 28, 2017 (gmt 0)

New User

joined:Nov 24, 2017
posts: 27
votes: 0


Fair enough... Well, here's what I've done. I've gone and bought another domain from a company offering a good deal (1 a month for the first year then 4.99 a month thereafter) and installed Wordpress on there. Now, I can actually learn the platform without the restrictions of whatever I'm facing on the other website, I'll seek help with that from the developers who made the site.

I'm good to go. Wordpress.org is installed, I'm in the process of making it fancy.