How to apply excerpt inside my XML data on WordPressHow does one parse XML files?How can I build XML in C#?How to Deserialize XML documentHow do I escape ampersands in XML so they are rendered as entities in HTML?How do I parse XML in Python?How do I comment out a block of tags in XML?How to add a PHP page to WordPress?How do you parse and process HTML/XML in PHP?How To Auto-Format / Indent XML/HTML in Notepad++How to pretty print XML from the command line?
Why aren't rainbows blurred-out into nothing after they are produced?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
Why are Gatwick's runways too close together?
How to reduce Sinas Chinam
Simplification of numbers
A continuous water "planet" ring around a star
What should I call bands of armed men in the Middle Ages?
How are you supposed to know the strumming pattern for a song from the "chord sheet music"?
How to assign many blockers at the same time?
What is the status of the F-1B engine development?
Word for an event that will likely never happen again
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
Heat equation: Squiggly lines
The cat ate your input again!
Redis Cache Shared Session Configuration
Why is there a large performance impact when looping over an array over 240 elements?
Why does the standard fingering / strumming for a D maj chord leave out the 5th string?
Annotating a table with arrows
Why did Gandalf use a sword against the Balrog?
Does the Fireball spell damage objects?
Are differences between uniformly distributed numbers uniformly distributed?
Is it feasible to get a hash collision for CRC32, MD-5 and SHA-1 on one file?
Are employers legally allowed to pay employees in goods and services equal to or greater than the minimum wage?
How to remove ambiguity: "... lives in the city of H, the capital of the province of NS, WHERE the unemployment rate is ..."?
How to apply excerpt inside my XML data on WordPress
How does one parse XML files?How can I build XML in C#?How to Deserialize XML documentHow do I escape ampersands in XML so they are rendered as entities in HTML?How do I parse XML in Python?How do I comment out a block of tags in XML?How to add a PHP page to WordPress?How do you parse and process HTML/XML in PHP?How To Auto-Format / Indent XML/HTML in Notepad++How to pretty print XML from the command line?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm pulling out the data from my CRM to my WordPress site using a XML.
It worked actually, but I want to add some functions like read more with the my XML data Web_Remarks[1]
it contains a long description.
Then I tried to add conditions from from my function.php
like excerpt and edit my descriptions code.
For my functions.php I add
<?php
// Customize excerpt for description word count length
function custom_excerpt_length()
return 25;
add_filter('excerpt_length','custom_excerpt_length');
?>
And for my description.php I change my <?php the_content();?>
to
<?php if ($post->post_excerpt) ?>
<p>
<?php echo get_the_excerpt(); ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php else
the_content();
?>
I expect the output should be "3Bed room with laundry ro..Read More..."
but what I have now is
"3Bed room with laundry room and sea view with 2 car parkings only for 3.06M!
-Bright
-Spacious
-Sea/Palm view
-Balconies
-Higher floor
-No Construction chance infront
-Prime location
real estate are a Property Investment Firm with an ownership of more than 2500 properties all around the world.These are handpicked exclusive apartments and villas, located within the most prestigious and high-profile developments of Dubai. We do not just believe in customer satisfaction, we aim for customer delight. We understand that our customers define the standard of quality and service and your loyalty must be earned."
php xml wordpress
add a comment |
I'm pulling out the data from my CRM to my WordPress site using a XML.
It worked actually, but I want to add some functions like read more with the my XML data Web_Remarks[1]
it contains a long description.
Then I tried to add conditions from from my function.php
like excerpt and edit my descriptions code.
For my functions.php I add
<?php
// Customize excerpt for description word count length
function custom_excerpt_length()
return 25;
add_filter('excerpt_length','custom_excerpt_length');
?>
And for my description.php I change my <?php the_content();?>
to
<?php if ($post->post_excerpt) ?>
<p>
<?php echo get_the_excerpt(); ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php else
the_content();
?>
I expect the output should be "3Bed room with laundry ro..Read More..."
but what I have now is
"3Bed room with laundry room and sea view with 2 car parkings only for 3.06M!
-Bright
-Spacious
-Sea/Palm view
-Balconies
-Higher floor
-No Construction chance infront
-Prime location
real estate are a Property Investment Firm with an ownership of more than 2500 properties all around the world.These are handpicked exclusive apartments and villas, located within the most prestigious and high-profile developments of Dubai. We do not just believe in customer satisfaction, we aim for customer delight. We understand that our customers define the standard of quality and service and your loyalty must be earned."
php xml wordpress
add a comment |
I'm pulling out the data from my CRM to my WordPress site using a XML.
It worked actually, but I want to add some functions like read more with the my XML data Web_Remarks[1]
it contains a long description.
Then I tried to add conditions from from my function.php
like excerpt and edit my descriptions code.
For my functions.php I add
<?php
// Customize excerpt for description word count length
function custom_excerpt_length()
return 25;
add_filter('excerpt_length','custom_excerpt_length');
?>
And for my description.php I change my <?php the_content();?>
to
<?php if ($post->post_excerpt) ?>
<p>
<?php echo get_the_excerpt(); ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php else
the_content();
?>
I expect the output should be "3Bed room with laundry ro..Read More..."
but what I have now is
"3Bed room with laundry room and sea view with 2 car parkings only for 3.06M!
-Bright
-Spacious
-Sea/Palm view
-Balconies
-Higher floor
-No Construction chance infront
-Prime location
real estate are a Property Investment Firm with an ownership of more than 2500 properties all around the world.These are handpicked exclusive apartments and villas, located within the most prestigious and high-profile developments of Dubai. We do not just believe in customer satisfaction, we aim for customer delight. We understand that our customers define the standard of quality and service and your loyalty must be earned."
php xml wordpress
I'm pulling out the data from my CRM to my WordPress site using a XML.
It worked actually, but I want to add some functions like read more with the my XML data Web_Remarks[1]
it contains a long description.
Then I tried to add conditions from from my function.php
like excerpt and edit my descriptions code.
For my functions.php I add
<?php
// Customize excerpt for description word count length
function custom_excerpt_length()
return 25;
add_filter('excerpt_length','custom_excerpt_length');
?>
And for my description.php I change my <?php the_content();?>
to
<?php if ($post->post_excerpt) ?>
<p>
<?php echo get_the_excerpt(); ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php else
the_content();
?>
I expect the output should be "3Bed room with laundry ro..Read More..."
but what I have now is
"3Bed room with laundry room and sea view with 2 car parkings only for 3.06M!
-Bright
-Spacious
-Sea/Palm view
-Balconies
-Higher floor
-No Construction chance infront
-Prime location
real estate are a Property Investment Firm with an ownership of more than 2500 properties all around the world.These are handpicked exclusive apartments and villas, located within the most prestigious and high-profile developments of Dubai. We do not just believe in customer satisfaction, we aim for customer delight. We understand that our customers define the standard of quality and service and your loyalty must be earned."
php xml wordpress
php xml wordpress
asked Mar 27 at 8:49
Carlvic Japitana LimCarlvic Japitana Lim
611 silver badge13 bronze badges
611 silver badge13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try,
<?php
$excerpt = get_the_excerpt();
if( !empty($excerpt) ) ?>
<p>
<?php echo $excerpt; ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php
else
the_content();
Or this will be a another method you can use:
<?php
// Add this code in functions.php file
function wp_get_custom_excerpt( $limit = '25' )
global $post;
$content = get_the_excerpt();
if( empty($content) )
$content = strip_shortcodes( $post->post_content );
$excerpt = wp_trim_words( $content, $limit, '[...]' );
return $excerpt;
// Remove your excerpt code and just echo function.
echo wp_get_custom_excerpt();
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to usethe_content()
for full content. this function can be used to get the excerpt only.
– Jaydip Nimavat
Mar 27 at 11:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373057%2fhow-to-apply-excerpt-inside-my-xml-data-on-wordpress%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try,
<?php
$excerpt = get_the_excerpt();
if( !empty($excerpt) ) ?>
<p>
<?php echo $excerpt; ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php
else
the_content();
Or this will be a another method you can use:
<?php
// Add this code in functions.php file
function wp_get_custom_excerpt( $limit = '25' )
global $post;
$content = get_the_excerpt();
if( empty($content) )
$content = strip_shortcodes( $post->post_content );
$excerpt = wp_trim_words( $content, $limit, '[...]' );
return $excerpt;
// Remove your excerpt code and just echo function.
echo wp_get_custom_excerpt();
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to usethe_content()
for full content. this function can be used to get the excerpt only.
– Jaydip Nimavat
Mar 27 at 11:15
add a comment |
Try,
<?php
$excerpt = get_the_excerpt();
if( !empty($excerpt) ) ?>
<p>
<?php echo $excerpt; ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php
else
the_content();
Or this will be a another method you can use:
<?php
// Add this code in functions.php file
function wp_get_custom_excerpt( $limit = '25' )
global $post;
$content = get_the_excerpt();
if( empty($content) )
$content = strip_shortcodes( $post->post_content );
$excerpt = wp_trim_words( $content, $limit, '[...]' );
return $excerpt;
// Remove your excerpt code and just echo function.
echo wp_get_custom_excerpt();
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to usethe_content()
for full content. this function can be used to get the excerpt only.
– Jaydip Nimavat
Mar 27 at 11:15
add a comment |
Try,
<?php
$excerpt = get_the_excerpt();
if( !empty($excerpt) ) ?>
<p>
<?php echo $excerpt; ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php
else
the_content();
Or this will be a another method you can use:
<?php
// Add this code in functions.php file
function wp_get_custom_excerpt( $limit = '25' )
global $post;
$content = get_the_excerpt();
if( empty($content) )
$content = strip_shortcodes( $post->post_content );
$excerpt = wp_trim_words( $content, $limit, '[...]' );
return $excerpt;
// Remove your excerpt code and just echo function.
echo wp_get_custom_excerpt();
Try,
<?php
$excerpt = get_the_excerpt();
if( !empty($excerpt) ) ?>
<p>
<?php echo $excerpt; ?>
<a href="<?php the_permalink();?>">Read More»</a>
</p>
<?php
else
the_content();
Or this will be a another method you can use:
<?php
// Add this code in functions.php file
function wp_get_custom_excerpt( $limit = '25' )
global $post;
$content = get_the_excerpt();
if( empty($content) )
$content = strip_shortcodes( $post->post_content );
$excerpt = wp_trim_words( $content, $limit, '[...]' );
return $excerpt;
// Remove your excerpt code and just echo function.
echo wp_get_custom_excerpt();
edited Mar 27 at 10:27
answered Mar 27 at 9:51
Jaydip NimavatJaydip Nimavat
3714 silver badges18 bronze badges
3714 silver badges18 bronze badges
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to usethe_content()
for full content. this function can be used to get the excerpt only.
– Jaydip Nimavat
Mar 27 at 11:15
add a comment |
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to usethe_content()
for full content. this function can be used to get the excerpt only.
– Jaydip Nimavat
Mar 27 at 11:15
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
Same nothing happen, It didn't limit my words.
– Carlvic Japitana Lim
Mar 27 at 10:21
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
@CarlvicJapitanaLim check answer updated.
– Jaydip Nimavat
Mar 27 at 10:27
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
now the limit is working but when i click read more the whole text description didn't show. I just refresh my page
– Carlvic Japitana Lim
Mar 27 at 10:44
You have to use
the_content()
for full content. this function can be used to get the excerpt only.– Jaydip Nimavat
Mar 27 at 11:15
You have to use
the_content()
for full content. this function can be used to get the excerpt only.– Jaydip Nimavat
Mar 27 at 11:15
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373057%2fhow-to-apply-excerpt-inside-my-xml-data-on-wordpress%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown