jimmyt1988
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: admin panel white screen of deathYOU… ARe.. A.. LEGEND. I love u, genuinely love u.
Forum: Fixing WordPress
In reply to: prevent comment nickname being “admin”Can I have an example.
My current function code is:
<?php function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php //echo get_avatar($comment,$size='20',$default='<path_to_url>' ); ?> <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?> </div> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.') ?></em> <br /> <?php endif; ?> <div class="comment-meta commentmetadata"><?php printf(__('%1$s - %2$s'), get_comment_date(), get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></div> <?php comment_text() ?> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> <div class = "commentSeperateLine"></div> </div> <?php }
it is loaded with a callback:
<?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doYou are.. BRILLIANT. absolutely brilliant. Thankyou. Thankyou. Thankyou. Im so happy. Im so so damn happy. YESSS !!!!! THSNKSSSNAKNASANSKANSS
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doFirstly, I got the pages listing correctly.
Instead of $request,/pagename/, it needed to be $request,pagename.
I’m sure i can sort the other if loops out.
Last question I guess is how do i list things via post date rather than post title ??
P.s, how can i thankyou for your sterling efforts and mega kind manner… It’s working exaclty how I imagined it. Beautiful.. damn damn beautiful. Thankyou so much.
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doAlso, my contact page and confirmation page no longer work because the original get or query posts has gone. Please refer to https://www.jamestrusler.co.uk/blog from now on, I had to put a underconstruction page up as visitors were getting lost (i love GAnalytics)
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doI can’t manage to get that part to work.
<?php $request = $_SERVER['REQUEST_URI']; if (strpos($request,'/music/')) { $cat_name = 'Music'; } elseif (strpos($request,'/poetry/')) { $cat_name = 'Poetry'; } elseif (strpos($request,'/pictures/')) { $cat_name = 'Pictures'; } else { $cat_name = 'Blog'; } $sql = "SELECT p.* FROM $wpdb->posts p JOIN $wpdb->term_relationships tr ON (tr.object_id = p.ID) JOIN $wpdb->term_taxonomy tt ON (tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.taxonomy = 'category') JOIN $wpdb->terms t ON (t.term_id = tt.term_id AND t.name = '$cat_name') WHERE p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_title ASC"; $mypages = $wpdb->get_results($sql); if ($mypages) : $limit = 3; // The number of posts per page $range = 5; // The number of page links to show in the middle $mypage = (isset($_GET['mypage'])) ? $mypage = $_GET['mypage'] : 1; $start = ($mypage - 1) * $limit; for ($i=$start;$i<($start + $limit);++$i) { if ($i < sizeof($mypages)) { // Process each element of the result array here $post = $mypages[$i]; setup_postdata($post);?> <div class = "leftSideWrap"> <h2><?php the_title(); echo " <small>"; the_time(get_option('date_format')); ?></small></h2> <div class = "top"></div> <div class = "middle"> <div class = "cornerImage"></div> <?php the_content(); ?> <div class = "commentSeperateLine dotted main"></div><br /> <p> <a href="<?php comments_link(); ?>"> Add / View Comments to this post</a> - <?php comments_number('There are currently no comments', 'There is 1 comment', 'There are % Responses' );?> </p> </div> <div class = "bottom"></div> </div> <?php } } echo _mam_paginate(sizeof($mypages),$limit,$range); else: echo '<h2>Sorry, There are no Pages to list</h2>'; endif;?> </div>
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to do<?php $cat_name = 'Blog'; $sql = "SELECT p.* FROM $wpdb->posts p JOIN $wpdb->term_relationships tr ON (tr.object_id = p.ID) JOIN $wpdb->term_taxonomy tt ON (tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.taxonomy = 'category') JOIN $wpdb->terms t ON (t.term_id = tt.term_id AND t.name = '$cat_name') WHERE p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_title ASC"; if ($mypages) : $limit = 3; // The number of posts per page $range = 5; // The number of page links to show in the middle $mypage = (isset($_GET['mypage'])) ? $mypage = $_GET['mypage'] : 1; $start = ($mypage - 1) * $limit; for ($i=$start;$i<($start + $limit);++$i) { if ($i < sizeof($mypages)) { // Process each element of the result array here $post = $mypages[$i]; setup_postdata($post);?> <div class = "leftSideWrap"> <h2><?php the_title(); echo " <small>"; the_time(get_option('date_format')); ?></small></h2> <div class = "top"></div> <div class = "middle"> <div class = "cornerImage"></div> <?php the_content(); ?> <div class = "commentSeperateLine dotted main"></div><br /> <p> <a href="<?php comments_link(); ?>"> Add / View Comments to this post</a> - <?php comments_number('There are currently no comments', 'There is 1 comment', 'There are % Responses' );?> </p> </div> <div class = "bottom"></div> </div> <?php } } echo _mam_paginate(sizeof($mypages),$limit,$range); else: echo '<h2>Sorry, There are no Pages to list</h2>'; endif;?> </div>
I have 4 categories:
Blog: name: Blog, slug: blog, id: 3
Music: name: Music, slug: music, id: 4
Poetry: name: Poetry, slug: poetry, id: 5
Pictures: name: Pictures, slug: pictures, id: 6I could do a for loop through it and use my array at top of page. But that code above is returning “Sorry, There are no Pages to list” so if that works i can figure out how to cycle through my pages.
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doHere is the latest version of the site:
https://wordpress.pastebin.com/kJjFB6SEHere is the site:
https://www.jamestrusler.co.ukForum: Fixing WordPress
In reply to: Pagination, Not sure what to doDone.
Now i need to show blog posts on blog page, poetry posts on poetry page etc.
Is there any way I can help?
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doevery part of the website comes from the index page.
The working version originally went through my array at the top and just output posts which I assigned to categories I made.
Is that the info you needed?
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to dofunctions code:
https://wordpress.pastebin.com/N1WDfwabPlease dont say sorry. You are all working your ass of and im so happy you’re all helping. Thanks for your trouble.
Side note: The posts showing do not only belong to do blog page, it is showing 1 post from each category. I need it to display blog posts on blog page, poetry posts on poetry page.. etc.
You can see from my array at top of page which category belongs to which page:
$i = 3; $pageNames[$i++] = "blog"; $pageNames[$i++] = "music"; $pageNames[$i++] = "poetry"; $pageNames[$i++] = "pictures";
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to doOk, here is my site at the moment:
https://www.jamestrusler.co.ukwith the code (search for “if ($mypages)”):
https://wordpress.pastebin.com/6BgM1NvgI had to change it to its working state before because I didn’t want the site to be down all day. So here it is, in non-functioning state.
this is what i want:
I want a loop that says:
if the page is blog, display posts i associate with blog page.
if there is more than 5 posts on the blog page, create a link at bottom that says goto next page of blog posts.In summary, it would be an archive. I only want the blog / poetry / picture / music page to display maximum of 5 posts, if there are more, I want them to archive.
I thought this was called pagination.
What you were seeing earlier was this (search for “/*IF PAGE IS ONE OF ARRAY PAGENAMES*/”):
https://wordpress.pastebin.com/kqrr1EN5
This code has no pagination but works great. If you would like to see this code in action then please just say.
I’m really stuck on what to do :S .
Forum: Fixing WordPress
In reply to: get_post query where posts don’t have a specific meta_keyAh, sorry If I wasted your time. I’m glad you found it !!! In fact, you helped me in the end. Cheers!
That solution is good. I reckon there is a quicker one. Wait till one of the gurus come on. They might give u a 2 liner hehe. Good luck in future.
Forum: Fixing WordPress
In reply to: get_post query where posts don’t have a specific meta_keyCan you refer to this:
https://www.ads-software.com/support/topic/319418?replies=15
I had a good read through it, It’s a little over my head. I hope that the above post triggers others to respond or yourself to understand.
Forum: Fixing WordPress
In reply to: Pagination, Not sure what to dofirstly, you’re a genius. You must have absored the wordpress codex.
It’s kind of unnatural.
Secondly, the phrase “bump” is worse than the “cowboy” phrase. ^_^
Thirdly.. And this is the exciting part:
Is now returning some junk with the current code.
https://wordpress.pastebin.com/Ta5341Tu
Unfortunately, the code has gone well out of my range. I havent just bummed out on it, I really read it and don’t understand it :S.
What’s your radar picking up esmi. I wish I could understand this stuff. It’s using the stuff vtx had recommended.. literally because it is the closest I have been.
I wonder what the wordcount is for “stuff” in this post ^_^
P.S
I see a pattern.. Its posting one comment from each section.. *reads over code*… *squeezes brain juice out*