Kevin Kwok
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.phpWOW i did not know you could do that thank you so much I will fool around with your idea and see if i cant come up with something thank you =)
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.phpopen to solutions or alternatives im pretty stumped.
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.phpthanks michael! thats definitely doing something however it looks like its just listing all the categories i have not specific ones the author has posts in. but i will keep working at it thank you!
ampersandbox.net/?author=2
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.phpstill wasnt able to achieve this not much of a php coder =\
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.php@michaelh
sorry about the duplicate i couldnt find the older one, thank you for closing it.=======================================================================
Hello!
my website: ampersandbox.net/?author=2Basically on every author’s page I would like to display a list on the right side of categories the current author has contributed to (has written a post in)
I’m not sure how to go about this but I started trying to write some code I came up with this code but for some reason it only displays one category which happens to be category 2. (check column on right labeled CATEGORIES)
<?php //Gets category and author info global $wp_query; $cats = get_the_category(); $postAuthor = $wp_query->post->post_author; $tempQuery = $wp_query; // related category posts $catlist = ""; forEach( $cats as $c ) { if( $catlist != "" ) { $catlist .= ","; } $catlist .= $c->name; $catlist .= $c->description; } $newQuery = "posts_per_page=5&cat=" . $catlist; query_posts( $newQuery ); $categoryPosts = ""; $count = 0; ?> <?php echo $catname .' '. $catlist; ?>
Forum: Fixing WordPress
In reply to: How do I….list categories an author has wrote in on author.phpi still cant seem to come up with a way to make this work=\
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….ha! just got it to work… thanks for um
telling me i couldnt? haha heres the codeif(isset($_GET['pg'])) { if($_GET['pg'] == "newest") // newest listing { $postslist = get_posts('numberposts=1'); foreach ($postslist as $post){ setup_postdata($post); echo thematic_indexloop(); } } elseif($_GET['pg'] == "featured") // featured listing { printr(featuredpostsList()); } elseif($_GET['pg'] == "random") // random listing { $postslist = get_posts('orderby=rand&numberposts=0'); foreach ($postslist as $post){ setup_postdata($post); echo '<div id="post-'; echo the_ID(). '" style="width:670px";>'; echo '<div class="entry-content">'; echo childtheme_post_header(). '<a href="'; echo the_permalink(). '"rel="bookmark">'; echo '<span class="slide-title" style=" font-family:Courier New; font-size:11px;">'; echo get_post_meta($post->ID, 'designed-by', $single = true). '<div style="width:145px; position:inherit; top:0px; " align="right">'; echo the_title(). '</div></span><img class="full-image" src="'; echo get_post_meta($post->ID, 'full-image', $single = true); echo '" width="150" height="113"></a></div></div>'; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// elseif($_GET['pg'] == "about") // about page { ////////////////////////////////////////////////////////////////////////////////////////// echo '<div style="float: right; position:absolute; padding-left:690px; padding-right:10px; font-family:Courier New; font-size:11px; width:180px;"> <a href="mailto:[email protected]">[email protected]</a></div>'; echo " About ampersandbox: <BR /><BR /> Ampersandbox is a project made for graphic designers to be creative without the <BR /> restraints of clients and classrooms, but within the parameters of an assignment.<BR /> Consider this your playground. A place to design and have fun doing it.<BR /> <BR /> Rules for play:<BR /> <BR /> 1. New assignments will be posted every week.<BR /> 2. All work must be submitted as .jpg or .gif format, 72 pixels, 640 x 480.<BR /> 3. Your first four assignments are required, and must be submitted within a week of<BR /> receiving your invitation.<BR /> 4. Once you have completed your four required assignments, you are welcome to<BR /> contribute to any past or future assignments, and at your own leisure.<BR /> <BR /><BR /><BR /> Ampersandbox was created by Marian Chiao as an independent-study project, instructed<BR /> by Simon Johnston, at Art Center College of Design, in the Fall of 2009. "; echo '"Assignments"'; echo "<BR /> inspired by the community art project Learning to Love You More by artists<BR /> Miranda July and Harrell Fletcher. Website built by Kevin Kwok. <BR /><BR /><BR /><BR /><BR /><BR /> "; echo ' <div style="position:absolute;margin-left:-10px;height: 1px; width: 660px; background-color: #000000; margin-top:-5px; margin-bottom: 15px;""> </div><BR /><BR />'; //////////////////////////////////////////////////////////////////////////////////////////// } } else { // default index - show categories with thumbnails for each // Modifications by Edward Wong // The following code obtains the variable "sortby" via the "get method" in PHP. // notice the index.php?sortby=ASC or DESC // This if statement checks if the variable is set or not // if it's not set, it'll give it the default value of ASC if(!isset($sortby)) { $sortby = 'DESC'; } $cat_args = array( 'orderby' => 'ID', 'order' => $_GET[sortby] // New Code ); $categories = get_categories($cat_args); foreach($categories as $category) { echo '<div>'; echo '<div style="float: right; position:absolute; padding-left:690px; padding-right:10px; font-family:Courier New; font-size:11px; width:180px;"> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "" )) . '" ' . '>' . $category->name. ' '.$category->description.'</a></div>'; $args = array( 'orderby' => 'ID', 'order' => 'DESC', 'showposts' => -1, 'category' => $category->term_id, 'caller_get_posts' => 1 ); $posts = get_posts($args); echo '<div style="float: left; width: 660px;">'; foreach($posts as $post) { setup_postdata($post); childtheme_post_header(); echo "<a href=\"".$post->guid."\" rel=\"bookmark\">"; echo '<div style="float: left; width: 150px; margin-right: 15px;">'; if(get_post_meta($post->ID, 'full-image', $single = true)) echo '<img class="full-image" src="'.get_post_meta($post->ID, 'full-image', $single = true).'" width="150" height="113" /><BR />'; else echo '<img class="full-image" src="'.bloginfo('url').'" width="150" height="113" /><BR />'; echo '<div style="height:50px;"> <div style="float: left; margin-top:6px;">'.get_post_meta($post->ID, 'designed-by', $single = true).'</div> <div style="float: right; margin-top:6px;">'.$post->post_title.'</div> <div style="clear: both;"></div> </div>'; echo '</div>'; echo '</a>'; } echo '</div>'; echo '<div style="clear: both;"></div>'; echo '</div>'; echo ' <div style="position:absolute;margin-left:-10px;height: 1px; width: 660px; background-color: #000000; margin-top:-5px; margin-bottom: 15px;""></div> <div style="position:absolute;margin-left:680px;height: 1px; width: 200px; background-color: #000000; margin-top:-5px; margin-bottom: 15px;"></div> <br />'; } } ?> </div>
hope this helps someone
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….not entirely true. when i added this code before
elseif($_GET['sortall'] == "random") // random listing { echo "random"; }
when random was clicked it only displayed “random”
and no posts. so i think its totally possible but thank you for your input.Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….I did it this way because the about page is different than other pages i will have in the future, it has different forms, etc
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….this part is key
if($_GET[‘pg’] == “about”)
meaning when ?pg=about is called anything under that if statement will display the text below
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….again, it was listed above but here it is now. this is how i added the code this is all the about page in this code i put on the index.php
if(isset($_GET['pg'])) { if($_GET['pg'] == "about") { ////////////////////////////////////////////////////////////////////////////////////////// echo " About ampersandbox: <BR /><BR /> Ampersandbox is a project made for graphic designers to be creative without the <BR /> restraints of clients and classrooms, but within the parameters of an assignment.<BR /> Consider this your playground. A place to design and have fun doing it.<BR /> <BR /> Rules for play:<BR /> <BR /> 1. New assignments will be posted every week.<BR /> 2. All work must be submitted as .jpg or .gif format, 72 pixels, 640 x 480.<BR /> 3. Your first four assignments are required, and must be submitted within a week of<BR /> receiving your invitation.<BR /> 4. Once you have completed your four required assignments, you are welcome to<BR /> contribute to any past or future assignments, and at your own leisure.<BR /> <BR /> <BR /> <BR /> Ampersandbox was created by Marian Chiao as an independent-study project, instructed<BR /> by Simon Johnston, at Art Center College of Design, in the Fall of 2009. "; echo '"Assignments"'; echo "<BR /> inspired by the community art project Learning to Love You More by artists<BR /> Miranda July and Harrell Fletcher. Website built by Kevin Kwok. <BR /><BR /><BR /><BR /><BR /><BR /><BR /><BR /><BR /> "; echo '<div style="float: right; position:absolute; padding-left:690px; padding-right:10px; font-family:Courier New; font-size:16px; width:180px;"> <a href="mailto:[email protected]">[email protected]</a></div>'; //////////////////////////////////////////////////////////////////////////////////////////// } }
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….the about page code is from the code listed above
Forum: Fixing WordPress
In reply to: index.php displaying extra info that is not wanted….still cant figure out what i am doing wrong, please help if you can. thank you in advance.
i was using a child theme i just reloaded a back up I had and it fixed it. thanks anyways!
i tried putting that at the very first line but then i get an error message about line one once i put it in there… =\