sixfootjames
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to use pages over posts for snippets in a custom WodPress siteThanks again Esmi.
It seems this option is working for me then.
/%category%/%postname%/
This at least results in…
https://www.example.com/news/news-articl-name
Other pages just link as normal then. ??
Forum: Fixing WordPress
In reply to: How to use pages over posts for snippets in a custom WodPress siteThanks Esmi.
I gave this some more thought.
To keep it simple, I would still use the posts (for the news items) but in WP, I could create a subpage called “News-items” and make it submenu under “News”.
In my Reading Settings (in WP), I could then tell the posts page to use the “News-Items” page.
What should then happen according to my understanding, is that when someone clicks on a post from the home page, it should redirect to…
https://www.example.com/news/news-item
Yet, this is not happening. Is there another configuration setting I might be missing?
Many thanks
Forum: Fixing WordPress
In reply to: Hacked WordPress sitesThanks Adpawl.
I will have a look into these. ??
Forum: Fixing WordPress
In reply to: Hacked WordPress sitesOtherwise, is there a plugin for WordPress that can notify me via email if the site has been attacked?
That’s a great start thanks vtxyzzy.
Now all I need is a way to associate the creation of the hi scores table with the user table information. ??Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameFinal working code snippet…thanks everyone!
function add_below_the_post () { global $post; $category = get_the_category(); $category = $category[0]->category_nicename; global $pagename; $news_page_name = $pagename; if (!is_wp_error($category)) { if ($category == 'student-stories') { echo('<a class="postFootLink" href="' .site_url() .'/people/student-stories/">Return to ' .$category .'</a>'); } else if ($category == 'news' && $news_page_name != 'news-events') { echo('<a class="postFootLink" href="' .site_url() .'/news/news-events/">Return to ' .$category .'</a>'); } else if ($category == 'research') { echo('<a class="postFootLink" href="' .site_url() .'/research/research-snippet/">Return to ' .$category .' snippets</a>'); } } } add_action('thematic_belowpost', 'add_below_the_post');
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameI have a feeling that might work! Let me give it a try and get back to you. I think the answer is in the global variable! Be back soon ??
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameHi Lee.
The two pages are already using two different templates.
I have systematically removed the hooks from my template-page-news.php (or your equivalent to “news-and-events”) template to see if I can remove it.
There are two hooks in this template:
thematic_indexloop();
&
thematic_belowcontent()From the bottom up, I have removed these hooks and nothing happens until I remove thematic_indexloop(). Only then do all most posts go missing which is understandable.
This then leaves me thinking that add_below_post() is being called every time within that loop.
See my dilemma? ??
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameThanks fore replying Keesiemeijer.
Basically what’s happening is that two pages share the same category, “news”.
This one: https://goo.gl/GvVuf
And this one: https://goo.gl/u89CEFrom the latter page, the news list page (https://goo.gl/u89CE), I need to remove the “Return To News” links as we are already on this page.
So in my IF statement, I need to exclude the links by either checking if we’re using a certain category, page ID or template…all of which I have tried and all of which don’t seem to work.
Many thanks again.
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameThanks for the replies. The problem I am having is when I debug for the post ID, it returns all the categories within the loop. You can see it here.
Above the title you will see I am writing the Post ID of that page (181). Below that and in the loop, you can see I am writing out the POST ID of each ID of news item.
This page (news-events) is made up of two parts; a template page called template-page-news.php and functions.php where the add_action() function is adding content below the post like so:
add_action(‘thematic_belowpost’, ‘add_below_the_post’);
It would seem that the page’s ID is not being passed into the loop when I check it like this:
else if ($category == 'news' && $post->ID != '181')) { echo('<a class="postFootLink" href="' .site_url() .'/news/news-events/">Return to ' .$category .'</a>'); }
If I do this however from one of the known ID’s in that loop, I can get rid of the button
else if ($category == 'news' && ($post->ID == '1188')) { echo('<a class="postFootLink" href="' .site_url() .'/news/news-events/">Return to ' .$category .'</a>'); }
I know this is going to be something simple when the lights go on ??
Thanks again!
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameHere is another option I have tried.
else if ($category == 'news') { if (is_page_template('template-page-news.php')) { echo('WORKING'); } else { echo('<a class="postFootLink" href="' .site_url() .'/news/news-events/">Return to ' .$category .'</a>'); } }
Now I know for sure that it is using the template “template-page-news.php” so it should write “WORKING” to the page and yet it doesn’t do this which leaves me wondering why this would not work within the add_action() function of Thematic wireframe.
Many thanks!
Forum: Fixing WordPress
In reply to: Checking if you are on a category AND a specific page ID / page nameHi Josh,
Thanks for getting back to me and your example. I tried it and a multitude of other options and still I am having some problems with it.
The latest option I have tried is to exclude the page I dont want the link to be echoed onto using IS NOT !is_page(‘news-events’). Like this…
else if ($category == 'news' && !is_page('news-events')) { echo('<a class="postFootLink" href="' .site_url() .'/news/news-events/">Return to ' .$category .'</a>'); }
I tried your method too but it seems to ignore it completely. Could it have to do with where this function is being called and that it is ignoring the is_page() call altogether?
Thanks again
Forum: Fixing WordPress
In reply to: How to wrap the_content() in a div with a classThis is what worked in the end…I had to change it slightly to wrap the <h2> tag as well…
<div class="entry-content"> <h1><?php the_title(); ?> </h1> <?php query_posts('cat=5&posts_per_page=4'); if (have_posts()) : while (have_posts()) : the_post();?> <?php echo '<div class="two-col">' ?> <h2><?php the_title();?></h2> <?php global $more; $more = 0; the_content(); echo '</div>'; endwhile; endif; // Reset Query wp_reset_query(); ?> </div>
Thanks again!
Forum: Fixing WordPress
In reply to: How to wrap the_content() in a div with a classThanks everyone, I will try these options now and come back with any problems I might have ??
Esmi..I am assuming you work for WordPress? You have just about answered all of my questions. Or does every WP user get it’s own Saint?
Thanks!