Tag Info

New answers tagged

0

Can you place custom .php files directly inside the child theme folder? Some of the research we found says you must write your custom PHP functions inside of the functions.php file. You can put in the folder directly and use it. Child theme templates work in a hierarchy. Child theme overrides the parent theme folder, so if you want to modify a ...


0

Can you place custom .php files directly inside the child theme folder? Yes, of course you can. WordPress is PHP. What works in PHP works in WordPress. Some of the research we found says you must write your custom PHP functions inside of the functions.php file. Nonsense. Many themes segregate code into multiple files, including "Twenty ...


2

Use switch_theme as already indicated in another answer, but hook it to wpmu_new_blog This function runs when a user self-registers a new site as well as when a super admin creates a new site. hook to 'wpmu_new_blog' for events that should affect all new sites. https://codex.wordpress.org/function_reference/wpmu_create_blog If not the code will ...


1

You can use the switch_theme function <?php switch_theme( $stylesheet ) ?> $stylesheet is the Stylesheet name.


0

with your code you completely redefine your CPT instead of just modifying the slug maybe this change the public access try this : $args = get_post_type_object("portfolio"); $args->rewrite["slug"] = "homepage"; register_post_type($args->name, $args);


0

You can't override the function(s). They aren't meant to be overwritten. See: "Override parent theme function that is not hooked or in the functions.php file" and "Is it possible to disable a function of a parent theme?". That is the direct answer to your question. You can, however, almost certainly achieve the result you want by using the filter provided ...


2

You are missing the Template: definition in your stylesheet header. This is the folder name of the parent theme For instance, a child theme of the bundled theme will have the Template: defined as Template: twentyfifteen


1

You need to use get_stylesheet_directory_uri() instead of get_template_directory() in your child theme. From the WordPress codex: get_template_directory_uri() In the event that a child theme is being used, the parent theme directory URI will be returned. get_template_directory_uri() should be used for resources that are not intended to be ...


2

Another option is: <?php echo str_replace('Brand: ','',get_the_archive_title()); ?> Replace Brand: with whatever text you are wanting to get rid of. Its worth looking into the difference between get_the_archive_title() and the_archive_title() the_archive_title() returns an array get_the_archive_title() returns a string


1

Sounds like there are two parts to your query: 1) Stop the first post from showing the full content, and 2) show the featured image on all the posts. 1) At the moment, the first post is using a different template to the other posts. To make the posts consistent, change this in index.php: get_template_part( 'content' ); to this: get_template_part( ...


2

get_template_part() would do that, if I understand your question. get_template_part('inc/custom'); It is sort of built to do exactly that, if I am reading you right: Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme.


3

locate_template will attempt to find the specified file in the child theme, and fall back to the parent theme if it does not exist: locate_template('inc/custom.php', true); Setting the second parameter to true causes it to require the file instead of just determining the path. As the name suggests, locate_template is meant for loading template files. It ...


0

I did not realize the page had a machine name of contact_us and not just simply contact. When I do !is_page('contact_us') it works.



Top 50 recent answers are included