How to add css to specific wordpress user to hide plugin fiction over front end? I installed the wp-about-author plugin but I need to set as hidden for admin user. So when the admin make any blog post then the wp-about-author wont be displayed. Unfortunately no feedback from the plugin developer. Thanks for any suggestions.
CSS way is not recommended since the user can check out actual DOM by view the source.
Instead, You can prevent from even showing up in the DOM Tree by modifying a plugin php file.
$level = get_the_author_meta('user_level');
if ($level == 10) {
return;
}
Add this line to wp-about-author.php on line #31.
This works, I tested.
Try to update plugin better then hack css :) You can add to wp-about-author.php on line #102 something like:
if (wp_admin()) $return_content = '';
I didn't check it, but might work for you.
Related
I've tried to use the frontend builder from Divi to hide the header and footer of the checkout page through Custom css (display:none) at the section settings.
The problem is that this disabled the Global Header and Footer and I can't see the items anymore to remove the code.
I've tried to enable again through the code #main-header { display:block!important; } but it did not work
Any ideas where can I find this code so I can erased it?
Seems like if I create a new template works but I can't find a way to enable the old one.
Best regards
if you've built your header through the theme builder, try to use this CSS
code
.et_pb_section_0_tb_header {
display : block;
}
it worked for me
and just for remark, you can remove the global header from one page without the need for custom CSS
check this blog post to know-how https://diveindivi.com/remove-the-header-and-footer-of-your-divi-website/
Not sure why my previous comment was deleted since this solution absolutely solved my problem. But here I go again, in case bouzina farid's answer does not work for some reason.
I've managed to solve the problem by using the tool "Export model" from Divi's Theme Builder. With the raw code in hands I've searched for the tag "display:none", remove the tag, save it and imported again.
i have look for Wordpress theme detector but i have no idea how it works and how to detect wordpress activated theme into theme folder. like https://theseotools.net/wp-theme-detector
please help me how can i did this.
I wrote this code for the purpose of readability. Normally, people would spend more than 10 lines of code fetching the name of an active wordpress template. There might be some minor adaptions needed, but nevertheless, this works. So, first we fetch the source code for the home page. Then we use regex to find style.css, then we use regex to fetch the name (refer to wordpress style sheet conventions), and yay we now have the name of the active theme. You can even get the download URI from here, as well.
<?php
$targetSite = ""; // put your wordpress url here
$src = file_get_contents($targetSite);
preg_match("/\<link rel='stylesheet'.*href='(.*?style\.css.*?)'.*\>/i",$src,$matches);
$styleHref = trim($matches[1]);
$styleSrc = file_get_contents($styleHref);
preg_match("/\Theme Name:(.*?)\n/i",$styleSrc,$name);
echo(trim($name[1]));
?>
How can I place a default text (hashtag) in the Custom Message?
The textarea is (located in line 643) under jetpack/modules/publicize/ui.php
I tried to put the text in front of $title in various ways, like:
<?php echo "#myhashtag $title"; ?>
or
<?php echo '#myhashtag '.$title; ?>
but it just echoes the text, not the $title.
Any ideas will be greatly appreciated.
You can use the approach of this Wordpress plugin i made (Publicize With Hashtags), which does exactly that. It basically use and action trigger bound to the 'save_post' native event.
If you want to develop your own one you can have a look at my Source Code on the project's GitHub page or in this installation & usage guide I wrote about it.
You can add a filter, like so, to your theme's functions.php or a site-specific plugin:
add_filter( 'wpas_default_prefix', 'add_default_publicize_hashtag_prefix', 10, 4 );
function add_default_publicize_hashtag_prefix() {
$default_tags = '#yourhastaghere ';
return $default_tags;
}
This will add your default hashtag before your title without you needing to hack the WordPress core.
jetpack/modules/publicize/ui.php itself states in its comments:
/**
* Only user facing pieces of Publicize are found here.
*/
You added your hashtag in the textarea which allows admins to enter a custom message (click edit and it will slide down with your hashtag).
As #Yazmin mentioned, the best way to permanently edit the message is using a filter. The filters available are wpas_default_prefix, wpas_default_message, and wpas_default_suffix.
Personally, I had no success using these filters and I'm interested in a working solution to this issue myself.
I want to theme the page /cart/checkout/complete
I already saw the settings in admin/store/settings/checkout/settings, but they are not enough.
I want to add some HTML i.e. add a print button at the top of the page.
I would like to have a .tpl.php file to use as template, or otherwise, using an alternate checkout page, how to insert the texts defined in checkout settings.
I tried to make a uc_cart_complete_sale.tpl.php but it isn't called.
Thank you in advance.
According to the Template Suggestion documentation you can provide a custom page.tpl.php for absolutely any path, so a template file with the following name would override page.tpl.php for the path cart/checkout/complete:
page--cart--checkout--complete.tpl.php
Be sure to clear Drupal's cache once you've create the file so the changes are picked up in the theme registry.
After hard work, i found the template page.
It is:
page--cart--checkout--complete.tpl.php
remember to clear the cache
firstly, you should probably check this page: admin/store/settings/checkout/edit/messages
there you can customize a header for the message displayed when the checkout completes.
other than that, you can implement some functions to alter this page. from a short look in the ubercart api maybe this function will do: my_module_checkout_complete() in this link the guy says it worked
another function that should work is theme_uc_cart_complete_sale
there are other options, such as in your template.php check if this is /checkout/complete and do whatever you want. like this:
if (arg(0) == 'cart' && arg(1) == 'checkout' && arg(2) == 'complete')
and than redirect to your page. anyway, there are plenty of ways to accomplish this, but just naming a file 'uc_cart_complete_sale.tpl.php' won't work. sorry...
In D6 at least, you can theme the message by overriding theme_uc_cart_complete_sale() - so if that's what you're after, theme the message by overriding that in your theme (for example, function mytheme_uc_cart_complete_sale($message, $order) {}
I'm trying to make a custom Taxonomy Term page in Drupal 7. I've created a page--taxonomy.tpl.php file in my templates folder. The file only prints out a message. I now try to force the template file by adding
function template_preprocess_page($variables) {
if (arg(0) == 'taxonomy') {
$variables['template_file'] = 'page--taxonomy-tpl';
}
}
in my template.php, but it won't work. Can you help me? And if I get the custom page working, how do I fetch the nodes with this term (in page--taxonomy.tpl.php)? Thanks in advance.
Try using this in your template.php:
function template_preprocess_page(&$variables) {
if (arg(0) == 'taxonomy') {
$variables['theme_hook_suggestions'][] = 'page__taxonomy';
}
}
You need to pass $variables by reference, so add a & before it
template_file has changed to theme_hook_suggestions in Drupal 7
You don't need the -tpl in the template suggestion unless you want it to be a part of the filename like "page--taxonomy-tpl.tpl.php" which I don't think is what you want.
For more information, check out template_preprocess_page(), theme_get_suggestions() and Working with template suggestions
Not sure if this would meet your requirements, but one of default D7 views - Taxonomy term - emulates Drupal core's handling of taxonomy/term pages. You could just enable it (it would automatically replace Drupal's core taxonomy URLs), and then do whatever you want with it, keeping original page structure, all blocks etc, using Views' page templates (see "Theming information" in "Advanced") and all other bells and whistles...
Since you are using Drupal 7, you could also create a file name "taxnomy-term.tpl.php" and edit according to your needs.
See taxonomy-term.tpl.php
Full control over the taxonomy term page can be obtained using hook_menu_alter() . See https://drupal.stackexchange.com/questions/48420/theming-and-overriding-taxonomy-term-vocabulary-page/111194#111194