All Questions
20 questions
0
votes
1
answer
633
views
How do I hide name surname information with substr?
My code allows me to hide the name Surname information with stars. But its output is as nameSurname >> n ****** e. I want it to be n **** S **** e. So I want the first letter of the last name ...
0
votes
1
answer
282
views
How Can I Get The First Value Before Comma Separated List?
Though this question seems similar to ones already asked, but this is a different case.
I have a php hook <?php echo zublum_display_breadLocation($pid);?> in my wordpress singular.php that ...
1
vote
1
answer
93
views
How to remove first few letter and print the last title in php
I have got the permalink and the page title. I need to remove the only permalink and print the title in using PHP.
Here is code:
$string = "http://example.com/blog/PageTitle"
From here remove the ...
0
votes
2
answers
1k
views
How to display the first character from a WordPress title
In WordPress we use the code <?php the_title(); ?> for displaying the title of a post. Now, I want to display only the first letter of the title in a different place. How can I do that?
I have ...
0
votes
3
answers
81
views
Verify if WordPress title starts with character
I am trying to verify if the WordPress post title starts with certain 3 first characters to achieve a condition. Here is what i tried by it brings back the title itself.
$verify = the_title();
if(...
0
votes
2
answers
141
views
substring - add ... in the end if text is cut
I have a code on wordpress website (front-page.php), it's cut text and add "..." on title if text is over 35 characters.
Cut is ok but the points is always visible. Is it possible to add only if text ...
0
votes
1
answer
97
views
Cut off text after a certain amount of characters via substr fail
I have a wordpress site for news, where i have to cut the text after certain amount of characters. It all works fine via substr(), but when there are less than x characters it goes crazy and generate ...
1
vote
4
answers
2k
views
remove part of string after delimiter in php
I have seen other
I have a string " cccc cccc - fff"
I need to return "cccc cccc" I don't need to delimiter too
I tried to echo the result of
substr($mystring , 0, strpos($mystring , "-"));
but ...
0
votes
2
answers
132
views
Wordpress, php. Using substr() on more variables creates conflict
I'm using 2 variables: check-in, check-out
Their format is: dd/mm/yyyy
I want separate the day, month and year into single variables,
in order to compare the integers of:
dd(check-in) with dd(check-...
0
votes
0
answers
79
views
Is there a way to detect if mb_substr should be used over substr?
I have two websites, one is in English one is a RTL language.
To create a custom excerpt in WordPress, I have created a function. But in the RTL site, if I use "substr()" to create the excerpt, I ...
1
vote
3
answers
152
views
substr PHP shorten lengh of a string (WordPress Plugin)
I am a novice at PHP I am just learning. But I have come across a problem that I am having real trouble with.
I am working inside WordPress with a plug-in and I am trying to shorten a string within ...
-1
votes
3
answers
274
views
sub string function in PHP not working
I want to display content in limit in wordpress using PHP substring function. I am using this code
<?php $content = get_the_content();
echo substr($content, 50); ?>
but it is not working. It ...
1
vote
1
answer
464
views
Substr needs to account for HTML tags
I'm working with Wordpress, and am outputting the_content of a post (with HTML formatting). I'm trimming it to 500 characters using substr.
I wanted to make sure that the content was not getting cut ...
0
votes
1
answer
253
views
Substr to exclude certain text - using a list of get_the_title()
Lets say I have a list of titles in wordpress eg. Item Name - (USA)
I would like to return just Item Name so everything after the - is not returned.
One catch is not all of the titles in my list ...
0
votes
1
answer
200
views
How can I split up a block of text using substr and a read more link to show the rest of it?
In wordpress a simple call is used to show the page content:
the_content()
I'm trying to develop a mobile optimised version of this, that will only show a portion of the content, with a 'Read More' ...
0
votes
2
answers
99
views
If two same character occurs, remove first and everything before it?
In Wordpress I have built shortcode which shorten url. Now there is problem if the url is a subdomain, for example: http://cdn.livestream.com/embed/channel, by shortcode function I get this:
<a ...
1
vote
2
answers
152
views
Post and excerpt
I have the following piece of code which outputs a long article:
<?php the_content(); ?>
I am trying to show only an excerpt of the article (the first 29 words), strip out the HTML and add a "....
2
votes
2
answers
170
views
Not returning a value in PHP in SUBSTR
Anyone know why this is not returning a value?
Example $item2['data'] where it = UPC
//===================================================//
Author: Bob Smith Orig. Published: December 12, 1980
...
2
votes
1
answer
545
views
UTF-8 hex counted as single character with mb_substr?
First off - I'm a php novice. I'm trying to limit the length of titles on a wordpress theme using mb_substr but it's returning fewer characters when there are certain symbols within the title such as "...
2
votes
2
answers
2k
views
Using the php substr on the_permalink() in WordPress
My urls for posts in WordPress looks like this:
http://localhost:8888/blabla/book/yes-vi-testar
Using the_permalink() would generate "http://localhost:8888/blabla/book/yes-vi-testar" but I want to ...