tiaanswart
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Showing first couple lines of postfunction continue_reading_link() { return '... <p><a href="'. get_permalink() . '" title="' . __( 'Continue Reading' ) . '" class="read-more-link">' . __( 'Read More ?' ) . '</a></p>'; } function auto_excerpt_more( $more ) { $content = get_the_content(); if ( !is_admin() && !empty($content) ) { if (!strpos($more,'class="read-more-link">')) { return continue_reading_link(); } } } add_filter( 'excerpt_more', 'auto_excerpt_more' );
Forum: Fixing WordPress
In reply to: Showing first couple lines of postMy apologies the functions for the read more link should be placed in your
function.php
file before or after the widget function.Forum: Fixing WordPress
In reply to: Showing first couple lines of postYou will need to add a filter to
excerpt_more
:First define the link for the read more link:
function continue_reading_link() { return '... <p><a href="'. get_permalink() . '" title="' . __( 'Continue Reading' ) ." class="read-more-link">' . __( 'Read More ?' ) . '</a></p>'; }
Then filter the
excerpt_more
:function auto_excerpt_more( $more ) { $content = get_the_content(); if ( !is_admin() && !empty($content) ) { if (!strpos($more,'class="read-more-link">')) { return continue_reading_link(); } } } add_filter( 'excerpt_more', 'auto_excerpt_more' );
Forum: Fixing WordPress
In reply to: WP Query Widget BooleanThanks for the solution. I tried implementing your solution and it still did not work. Somehow the pre_get_posts filter is overriding the other filters. I will stick with the hack until I have more time to come up with a more permanent solution.
Forum: Fixing WordPress
In reply to: Showing first couple lines of postIf you simply want to trim the amount of characters then use
substr
.Replace the below line of code:
$content = get_the_content();
With:
$content = substr(get_the_content(),0,10);
The first argument passed is the sting you want to reduce, second is the character number from where the the function should start counting and the third would be the number of allowed characters.
Forum: Fixing WordPress
In reply to: WP_Query and limit postMy apologies my code was missing a
;
on the end of line 5.The code should look like this:
$sticky = get_option( 'sticky_posts' ); if ($sticky) { $sticky = array_slice($sticky, 0, 5); } $featured_args = array( 'post__in' => $sticky, ); $featured_loop = new WP_Query( $featured_args ); while( $featured_loop->have_posts() ) : $featured_loop->the_post();
Your solution is correct however your query is doing some unnecessary work getting all the posts and then only using some of it. Won’t it rather make sense querying the correct (amount of) data?
Forum: Fixing WordPress
In reply to: Woo Commerce PHP error? Please Help!!I think you have a plugin installed (might be the theme you are using as well) that is trying to either redirect or re-declare the header.
I would advise you switch themes to Twenty Twelve and then activate the plugin again to see if the issue is with the theme or the plugin. If it still fails then please contact the support team at WooCommerce.
Forum: Fixing WordPress
In reply to: Removing Index.php in Permalinks using IIS 8change your web.config to:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <defaultDocument enabled="true"> <files> <add value="index.php" /> </files> </defaultDocument> <rewrite> <rules> <rule name="WPurls" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Forum: Fixing WordPress
In reply to: How do I link wordpress blog to google plus business page?There is an easy to follow tutorial for this like Seacoast suggested:
https://www.plus1followers.com/how-to-create-google-plus-business-page/
Please search Google for more tutorials/tips.
Forum: Fixing WordPress
In reply to: How To Add Logout LinkPlease refer to the codex:
https://codex.www.ads-software.com/Function_Reference/wp_logout_url
You can use something like this:
echo '<a href="'. wp_logout_url( get_permalink() ) .'" title="Logout">Logout</a>';
Forum: Fixing WordPress
In reply to: WP_Query and limit postyou need to reduce the amount of sticky posts before you include it in the query args like so:
<?php $sticky = get_option( 'sticky_posts' ); if ($sticky) { $sticky = array_slice($sticky, 0, 5) } $featured_args = array( 'post__in' => $sticky, ); $featured_loop = new WP_Query( $featured_args ); while( $featured_loop->have_posts() ) : $featured_loop->the_post(); ?>
Forum: Fixing WordPress
In reply to: How to change name servers?wordpress.com is a free blog host unless you pay you cannot change the domain.
Please see:
https://store.wordpress.com/premium-upgrades/custom-domains/
Forum: Fixing WordPress
In reply to: Trouble embedding Vimeo videosDrop this little snippet in your html head section:
<script type="text/javascript"> $(function() { var $allFigures = $("iframe[src^='https://player.vimeo']"), $fluidEl = $("figure"); $allFigures.each(function() { $(this) // jQuery .data does not work on object/embed elements .attr('data-aspectRatio', this.height / this.width) .removeAttr('height') .removeAttr('width'); }); $(window).resize(function() { var newWidth = $fluidEl.width(); $allFigures.each(function() { var $el = $(this); $el .width(newWidth) .height(newWidth * $el.attr('data-aspectRatio')); }); }).resize(); }); </script>
and embed the vimeo video using the following format:
<div> <figure> <iframe width="1600" height="900" src="https://player.vimeo.com/video/#YOUR-VIMEO-ID-HERE"></iframe> </figure> </div>
Forum: Fixing WordPress
In reply to: Showing first couple lines of postOr you can swap get_the_content() with get_the_exerpt()
Forum: Fixing WordPress
In reply to: how to show Category which has no post ??Try this:
<ul> <?php wp_list_categories( array( 'show_count' => 1 , 'hide_empty' => 0 ) ); ?> </ul>