Chirag Swadia
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Installing pluginsYou should add the following code with your FTP details in wp-config.php
define( 'FTP_USER', 'username' ); define( 'FTP_PASS', 'password' ); define( 'FTP_HOST', 'ftp.example.org:21' );
Other thing you can do is give full permissions to the current user so that wordpress can automatically create folders and files in
wp-content/plugins
Run these two commands with www-data replaced with your username and
wordpress replaced by the path to your wordpress installation.chirag$ cd /var/www chirag$ sudo chown -R www-data:www-data wordpress
Forum: Fixing WordPress
In reply to: WP shows all categories, only want oneThe problem you are facing is because you are modifying the default wordpress query. You are right that on the category page wordpress will only show posts with the category none others.
But since you have used
$args = array('posts_per_page' => 6,'post_type' =>'larsarholmnet_posts'); $query = new WP_Query( $args );
You are nowhere mentioning the category in the custom query.
So if you want proper functioning use the following code.
<?php get_header();?> <section class="featured-post fifteen columns row"> <h1><?php single_cat_title(); ?></h1> <ul> <?php $category_id = get_query_var('cat'); $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args = array('posts_per_page' => 6, 'post_type' => 'larsarholmnet_posts' 'cat' => $category_id, 'paged' => $paged ); $query = new WP_Query( $args ); while ($query->have_posts()) : $query->the_post(); ?> <div class="cat-thumb"> <a>"> <h2><?php the_title();?></h2> <?php the_post_thumbnail('cat-thumb'); ?> <p><?php the_excerpt(); ?></p> </a></div> <?php endwhile;?> </ul> <div id="push"></div> </section> <?php get_sidebar();?> <?php get_footer();?>
For the pagination links to be visible you will have to use
paginate_links()
function as well below your postsForum: Fixing WordPress
In reply to: How to create a tag link "alternative" dynamicallyCheers ?? Have a good day.
Forum: Fixing WordPress
In reply to: Post thumbnails/ featured image not in the post1) For this one, you`ll have to change the CSS and markup also. Will not be able to explain it here though.
2) Add
<div><?php the_post_thumbnail(); ?></div>
after<div class="posttitle"></div>
line in index.phpForum: Fixing WordPress
In reply to: How to create a tag link "alternative" dynamicallyFirst of all download the file Mobile_Detect.php from the following link https://github.com/serbanghita/Mobile-Detect/blob/master/Mobile_Detect.php
Note – This library is used by many users around the world for mobile detection. Even wordpress uses it ??
Add it to your project.
After you add it, Include the following code snippet in your header.
include("Mobile_Detect.php"); /* put the path where you have added the mobile detect file */ $detect = new Mobile_Detect(); if ($detect->isMobile() || $detect->isTablet()) { <link href="mobile/tablet"> }else{ <link href="desktop"> }
Forum: Fixing WordPress
In reply to: How to create a tag link "alternative" dynamicallyThe way you are talking about is quite tedious.
I was preferring browser detection because a single code on all the pages will check whether the request is coming from a desktop or a mobile.
Based on that it will add the suitable link attribute.
The code that you are using for redirection is fine but for dynamic link attribute I would go for browser detection.
Forum: Fixing WordPress
In reply to: Post thumbnails/ featured image not in the postAdd
<?php the_post_thumbnail(); ?>
anywhere after title is displayed i.e.<?php if (have_posts()) : while (have_posts()) : the_post(); <div class="posttitle"> --- --- </div> <div><?php the_post_thumbnail(); ?></div> ?>
If you want images on blog listing page too, then it will not work by adding it on single.php or page.php.
You need to add
<div><?php the_post_thumbnail(); ?></div>
after<div class="posttitle"></div>
in index.phpForum: Fixing WordPress
In reply to: How to create a tag link "alternative" dynamicallyThis can be done through jQuery, but a better way of doing this would be through php.
You can perform browser detection in php and then based on that load the appropriate link attribute.
For Eg.
<?php if( desktop browser ){ <link href="browser site"> }else{ <link href="mobile site"> } ?>
Forum: Fixing WordPress
In reply to: Changing wp-config settingsYou should first of all create a new user for the existing wp database from Cpanel.
Then edit your wp-config.php with the username and password for the newly created user.
Once this is done, you can safely delete the old user from your Cpanel.
Forum: Fixing WordPress
In reply to: Post thumbnails/ featured image not in the postYou do not have to add
<?php the_post_thumbnail(); ?>
anywhere in your theme`s single.php file.You should add the particular line inside the wordpress loop. For example.
while(have_posts()){ the_post(); the_post_thumbnail(); }
Forum: Fixing WordPress
In reply to: Sugar and Spice Theme Footer TroubleGreat. You can mark this ticket as fixed. (y)
Forum: Fixing WordPress
In reply to: Sugar and Spice Theme Footer TroubleThat’s cool ??
Forum: Fixing WordPress
In reply to: Sugar and Spice Theme Footer TroubleI mean copy the old footer code as in the default theme code ( before you made any changes )
Then make the above changes
Forum: Fixing WordPress
In reply to: How to create a Page index of blog PostsHave you changed the code in content-blog.php ?
i.e.
Replacing
<?php if ( is_search() ) : // Only display Excerpts for Search ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php else : ?> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content --> <?php endif; ?>
with
<div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary -->
Forum: Fixing WordPress
In reply to: Skipping to the Last post in a loop – with PaginationYou can use
order=DESC
in query_posts
if you want reverse order of posts.The other thing can be to redirect the user to the last page url using the
wp_redirect ( $last_page_url ); exit;