The simpler media website CMS
The news page listing to all the news articles does not return the correct path.
When url is to /news/ without any specific category, the returned path is to /page/2 instead of /news/2.
I was going to try to insert some of the html from the page, but it seems to get messed up on preview, so you can go look yourself.
The problem appears to be in the way a filter is applied. Digging deeper, the function getNewsPathNav($page) returns the path used above.
return zp_apply_filter('getLink', rewrite_path($rewrite, $plain), 'news.php', $page);
where parameter are defined as:
$page=1
$rewrite="/news/2"
$plain="index.php?p=news&page=2"
rewrite_path($rewrite, $plain)="/news/2/"
A link to the website where this is deployed can be found at http://www.hippiehollow.net/news/
I have installed Zenphoto 1.5.7
I suspect that it may be a similiar problem with the All News link in the sidebar.
Comments
I do think this is something on your site as I cannot reproduce this (prime example on our own site).
Since you are not using a standard theme please try if that also happens with the plain Zenpage theme. If it doesn't it is your custom theme somehow. If it also happens there might be some other issue specific to your site. For example if your other site's componenst also use htaccess or there is a parent on the may intefere.
You said you upgraded. Which version did you upgrade from? Just in case you are not having the correctl htaccess file. At the beginning there should be
# htaccess file version 1.4.12
And I forgot the most usual question: Any errors in the logs?
I am using a copy of the Zenpage theme only slightly modified the existing
You are correct. The problem has something to do with the theme. I started new with copy of the Zenpage theme and reinserted the modifications. Now the news links appear to be working properly. I do not know what condition was causing the problem, but I will pay attention to the behavior of the news links as I apply any future changes.
htaccess file version 1.4.12, so that is not the problem. This was a new install, my first time to use Zenphoto. I am thinking that if there is new version coming soon, I might not want to spend too more time with this version until the new release.
Good you found the general cause. What modifications did you apply? I cannot think of any changes at the moment causing these links to change unless you override the filter with something else.
Yes, next version will be 1.5.8 and no changes in this area. Theme things should not be affected by it.
the only modifications are to what you see, graphics and text, custom css to modify the look, removed some titles and replaced, positioning of existing elements on the page. Nothing major at all.
I did play around with using the codeblock(2) to insert style overrides on only a few pages. If I placed <style tag in the extra or custom fields then the code was stripped. By embedding it in echo I was able to retrieve and use it.
Also the text for the news is only formatted with 0A linebreaks. I use the codeblock(1) to echo nl2br( getNewsContent()); instead of using the printnewscontent() that is standard.
but all those modifications did not seem to be the problem.
thanks for the help.
Yes, those modifications should not change the links, so it must be something else…
A few quick notes:
If you use codeblock as they are in the Zenpage theme using
<style>
would cause invalid HTML.<style>
is only valid in the<head>
of a HTML page. Best is to modify the theme's css file or add your own extra css file. (which is why it is cleared as it is not an allowed element here)"get" functions generally just return plain data while especially in this case the "print" version does a lot more for output.
Enable the tinyMCE editor to get actual HTML formatting of text. It actually should be enabled by default. Without it the text is not really formatted at all excecpt line breaks or what you add manually as extra HTML.
Yes I will try the the editor. But you did not understand how I am using the codeblock(2) for the style. If you have a page that need to override the styles in the <link ref="style... then I use in codeblock(2) php with the echo "<style type=...
Then if there is any in codeblock(2) then it is inserted into the <head. It works great.
Ok, so you added a 2nd codeblock to your theme as the zenpage theme does not use that by default. Then this of course works.
But even better it would be to use the
'theme_head'
filter hook to add custom css.I have only been using Zenphoto for a couple of weeks. I try to search for examples but typically end up doing from the best of my simple abilities to get my ideas to work. I regularly go back and redo when I find a better way. I see where the 'theme_head' filter is applied at the top of the <head. I would need my custom.css to be applied after the style.css. And what I am doing is overriding any css defined previously by placing just before /head>
But I might dive into registering filters later after I get more familiar with Zenphoto.
We cannot give concrete examples for everything as all is just PHP. If you haven't I suggest to read the theming tutorial on the user guide section of our site for the basics.
Official themes don't use these filters (actually unknown reasons) but a lot plugins do. Apply directly in within head is of course not totally wrong but using the filter allows to do that without editing the theme itself.
Filters can be applied with priority parameter to define the load order.
You find the generel documentation from the code source here:
https://docs.zenphoto.org
But you need some PHP knowledge to understand all this.
thanks for challenging me to try that as a filter. I think that is a better way to handle it.
function defaultCSS() {
?>
<link rel="stylesheet" href="/themes/zenpage2/style.css" type="text/css" />
function customCSS() { ?>
<link rel="stylesheet" href="/themes/zenpage2/custom.css" type="text/css" />
<?php
}
function pageCSS() {
printCodeblock(2);
}
zp_register_filter('theme_head', 'defaultCSS',4);
zp_register_filter('theme_head', 'customCSS',3);
zp_register_filter('theme_head', 'pageCSS',2);
i had a hard time getting code to show in a post, some of the structure is missing but you can get the general concept, let me know if there is a better way
Yes, that looks like what I suggested!
Regarding the code example: You have to use markdown formatting, there is a link to a guide below each post field. It's pretty simple, bascially just add some space before a line