Mohammad mahdi aghakhani
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Prevent Audio files to download at page loadsThank you @threadi, you are amazing!
I’m working with WordPress for more than 5 years and I didn’t noticed this option, Thank you for real!
I did another thing and it’s work correctly on everything, I just want to know that is it a good way?
I added this fucntion to my function.php:
/Changing internal links/
function replace_image_urls($content) {
// Replace all instances of the old domain with the new domain in the image sources.
$content = str_replace(‘oldschooll.ir/files’, ’ememay.ir/wp-content’, $content);
$content = str_replace(‘oldschooll.ir’, ’ememay.ir’, $content);// Return the updated content.
return $content;
}
add_filter(‘the_content’, ‘replace_image_urls’);It change all the strings in every page to the correct one, is it safe? and is it the best way to do all of this automatically?
It did great and everything is fine now, But I want to make sure it won’t hurt anything,
I’m an SEO expert and in terms of SEO, I think it’s not hurt SEO in any aspects. but I want more POV
Thank you
Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titleunfortunately didn’t work for me.
are you sure this function get the number of the posts that have the cat or tag and then insert it before the page title ?- This reply was modified 3 years, 5 months ago by Mohammad mahdi aghakhani.
Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titleI’m really not good at PHP to do something with this code!
I just insert it to myfunction.php
but doesnt work.Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titleI almost know that the correct hook for this job is
post_type_archive_title
.
But im not good at PHP and i cant write the correct code to do that.
Can you or someone else change the code i left below with thepost_type_archive_title
?function add_before_content($content) { $id = get_queried_object_id(); $term = get_category( $id ); $count = $term->count; return $count.$content; } add_filter('single_cat_title', add_before_content);
I correctly take the number but i cant insert it before the tag or cat page of my own post type
Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titleThank you but there is something wrong with your code!
get_the_archive_title
works for wordpress defult taxonomy(like tags and categories)
But i need something that change the title of tag or cat page in my custom post type!I build a new post type with the Jetengine plugin.
My post type slug is
lyric
, how can i hook to the title of my cusotm post type tag or category page?
This is the real problem.Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titleunfortunately I’m not good at PHP
how can I do what you say ?
can you send me the correct code ?Forum: Developing with WordPress
In reply to: how to hook to custom post type tag titlei think
get_the_archive_title
is for wordpress defult post type(like posts and pages)
I triedget_term
but it doesnt workForum: Developing with WordPress
In reply to: how to hook to custom post type tag titleI tried this new hook but this didn’t work, can you send me the correct code and rewrite my code ?
Forum: Fixing WordPress
In reply to: how can I insert text before the title of tag page ?The Title in the page (h1)
Page builder: elementor
Theme : hello elementorForum: Developing with WordPress
In reply to: How to execute the condition correctly in function.phpIm thinking that your notice helped me to find out something
Forum: Developing with WordPress
In reply to: How do I know if a page is tag page or not?Thank you all guys
Forum: Developing with WordPress
In reply to: How do I know if a page is tag page or not?thank you @bcworkz, it works
Forum: Developing with WordPress
In reply to: How do I know if a page is tag page or not?I did this in your way and it correct way
but there is something wrong with it
when I wrote this code it gave me about 6,7 “something” or “something else”function test(){ if(is_tag()){ echo 'something'; }else{ echo 'somthing else'; } } add_action('parse_query','test');
I just need one echo not anymore but it gave me 6,7 times
Forum: Developing with WordPress
In reply to: How do I know if a page is tag page or not?How can i use this conditional in a function?
When i write this code it doesnt work:Function test(){ if(is_tag()){ echo 'something'; }else{ echo 'somthing else'; } } add_action('init','test');
- This reply was modified 3 years, 6 months ago by Mohammad mahdi aghakhani.