macaela007
Forum Replies Created
-
I am sorry for my ignorance but I still don’t understand could you please add example on my code or on new code, so my aim is orderby post_count in ASC or DESC?
my current code:
<?php $args = array ( 'post_type' => 'post', 'posts_per_page' => '16', ); $the_query = new WP_Query ($args); if ($the_query-> have_posts()) { $authorArgs = array( 'orderby' => 'ID', 'posts_per_page' => 1, 'has_published_posts' => array('post'), ); $authors = get_users(); $authors = get_users( array( 'user_registered' => 'blankwordpress' ) ); echo '<table> <tr> <th>Company</th> <th>Contact</th> <th>Country</th> </tr> '; foreach ( $authors as $author ) { $posts = count_user_posts($author->ID, 'post'); echo '<tr><td>' . esc_html( $author->first_name) .' </td><td>' . esc_html( $author->last_name) . '</td><td> ' . $posts . '</td></tr>'; echo '</table>'; echo '<ul>'; while ($the_query-> have_posts()) { $the_query-> the_post(); echo '<li>'. get_the_title(). '</li>'; echo '<li>'. get_the_author(). '</li>'; } echo '</ul>'; } else { // no posts found } ?>
Hi it accepts orderby post_count but not order in ASC or DESC if does please do show me how as I am been a week trying to find a way.
Forum: Networking WordPress
In reply to: Cant Access second multisite dashboardThis is whats on the web config
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:1}" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
and this is on my htaccess
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ wp/$1 [L] RewriteRule . index.php [L]
the main site works fine but everytime i create another site I Can’t go to the dashboard
Forum: Fixing WordPress
In reply to: Thumbnails selectionWell I need those different thumbnails sizes, but not everytime I upload an image just looking for a option where I can choose what size to upload without making a duplicate is that not possible??
Forum: Hacks
In reply to: how to echo custom category from page categoryHi I found a function that made it work are you familiar with it.
/** * Conditional function to check if post or page belongs to term in a custom taxonomy. * * @param tax string taxonomy to which the term belons * @param term int|string|array attributes of shortcode * @param _post int post id to be checked * @return BOOL True if term is matched, false otherwise */ function pa_in_taxonomy($tax, $term, $_post = NULL) { // if neither tax nor term are specified, return false if ( !$tax || !$term ) { return FALSE; } // if post parameter is given, get it, otherwise use $GLOBALS to get post if ( $_post ) { $_post = get_post( $_post ); } else { $_post =& $GLOBALS['post']; } // if no post return false if ( !$_post ) { return FALSE; } // check whether post matches term belongin to tax $return = is_object_in_term( $_post->ID, $tax, $term ); // if error returned, then return false if ( is_wp_error( $return ) ) { return FALSE; } return $return; }
and then call it
<?php if (pa_in_taxonomy('page_category', 'hello')) { echo "Western films are great"; } else { echo "edy"; } ?>
Thanks for your help
Forum: Hacks
In reply to: how to echo custom category from page categorydo you mean like this if so still didnt work
<?php if (is_tax('page_category')) { echo "<p>Western films are great</p>"; } else { echo "<p>comedy</p>"; } ?>
register_taxonomy('page_category', 'page', array( 'label' => 'Categories', 'hierarchical' => true, ));
Forum: Hacks
In reply to: how to echo custom category from page categoryyes both where the category is hello and one that the category is not hello.
Forum: Hacks
In reply to: how to echo custom category from page categoryHi just tried still didnt work the pages still only given me the else event thou I tick the page category, does category doesnt work on page only on post or something?
<?php if (is_tax('page_category', 'hello')) { echo "<p>Western films are great</p>"; } else { echo "<p>comedy</p>"; } ?>
Forum: Hacks
In reply to: how to echo custom category from page categoryHi I tried if is tax still didnt work this is how I did it.
<?php if (is_tax('hello')) { echo "<p>Western films are great</p>"; } else { echo "<p>comedy</p>"; } ?>
this is how i’ve created the tax by adding this line inside the function do I need anything else I’ve ticked the category on the CMS but still nothing always echo the else on the page
register_taxonomy('page_category', 'page', array( 'label' => 'Categories', 'hierarchical' => true, ));
Do I need to do differently ?
Forum: Themes and Templates
In reply to: will wordpress update delete my twentyeleven changes?thanks
Forum: Themes and Templates
In reply to: will wordpress update delete my twentyeleven changes?HI thanks getting back at me, can i ask, can I just copy the whole function of the twentyeleven theme on to the child theme because I dont want to mess with it too much I’ve added a few extra functions on the function.php if at momement I have same functions on function.php on both parent and child theme will that affect the way my site will work? if not can I do it?
Forum: Fixing WordPress
In reply to: Functions only returning one post when it should show allHi is working perfect thanks alot I’ll post the whole function here in case someone pump into in the future.
once again thanks alot<?php //function to display the third last news published function wptuts_third_last_news_shortcode($atts, $content=null) { query_posts( 'category_name=news' ); if (have_posts()) : while (have_posts()) : the_post(); $blog_link = get_permalink(); // this si the link $return_string .= "<a href=" .$blog_link .">" . get_the_title() . "</a> <br />" ; endwhile; endif; wp_reset_query(); return $return_string; } add_shortcode( 'third_last_news', 'wptuts_third_last_news_shortcode'); ?>
here the link to my site
my siteyes it did display before I even have two functions they mean to do the same job display latest post. the first one works fine except that it show the last post twice on the homepage at the top and at the bottom of the content,
the second function I just cant get the ( MORE ) to appear.
here a link to my page
click on the link (click here to see the function txt file) to see the the two functionsMy aim is to be able to display the latest post on the homepage and use the more function on the text editor to shorten the display on on the homepage
would really appreciate any help.
do you mean like this
<?php function wptuts_recentpost($atts, $content=null){ global $more; // Declare global $more (before the loop). $more = 0; // Set (inside the loop) to display content above the more tag. $getpost = get_posts( array('number' => 1) ); $getpost = $getpost[0]; $return = $getpost->post_title . "<br />" . $getpost->post_content . "…"; $return = $getpost->post_title . "<br />" . apply_filters('the_content',$getpost->post_content) . "…"; } add_shortcode('newestpost', 'wptuts_recentpost'); ?>
it doesnt display any post