yourcodesupport-blog
yourcodesupport-blog
Programming language
52 posts
We always supporting you with your codes
Don't wanna be here? Send us removal request.
yourcodesupport-blog · 6 years ago
Text
How to Protect your WordPress Admin Area
This  is important to restrict the access to your WordPress admin area only to people that actually need access to it. If your site does not support registration or front-end content creation, your visitors should not be able to access your /wp-admin/ folder or the wp-login.php file. The best you can do is to get your home IP address (you can use a site like whatismyip.com for that) and add these lines to the .htaccess file in your WordPress admin folder replacing xx.xxx.xxx.xxx with your IP address:
12345<Files wp-login.php>order deny,allowDeny from allAllow from xx.xxx.xxx.xxx</Files>
In case you want to allow access to multiple computers (like your office, home PC, laptop, etc.), simply add another Allow from xx.xxx.xxx.xxx statement on a new line.
And do not forget- DO not never use  USER as login ! 
3 notes · View notes
yourcodesupport-blog · 6 years ago
Text
Remove WordPress Version Number
By default WordPress adds the WordPress version in your website’s header. Some people think it’s a security liability to which our answer is to keep WordPress updated.
However if you want to remove the WordPress version number, simply add the following code to your theme’s functions.php file or a site-specific plugin.
1234
function
wpbeginner_remove_version() {
return
''
;
}
add_filter(
'the_generator'
,
'wpbeginner_remove_version'
);
For more information on this topic see our article on the right way to remove WordPress version number.
0 notes
yourcodesupport-blog · 6 years ago
Text
Display Total Number of Comments in WordPress
.
Comments provide an easier way for users to engage with content on your website. Showing total number of comments can be used as social proof and encourage more users to participate in discussions.
The easiest way to do this is by installing the Simple Blog Stats plugin. Upon activation, you can add [sbs_apoproved] shortcode to any post or page to display total number of comments.
0 notes
yourcodesupport-blog · 6 years ago
Text
WP-Add Categories to WordPress Pages
Want to add categories and tags to pages in WordPress? By default, they are only available for posts. Mainly, because pages are supposed to be static standalone content (see difference between posts and pages in WordPress).
If you want to add categories and tags, then simply add this code to your theme’s functions.php file or a site-specific plugin.
123456789101112131415
// add tag and category support to pages
function
tags_categories_support_all() {
 register_taxonomy_for_object_type(
'post_tag'
,
'page'
);
 register_taxonomy_for_object_type(
'category'
,
'page'
);  
}
// ensure all tags and categories are included in queries
function
tags_categories_support_query(
$wp_query
) {
 if
(
$wp_query
->get(
'tag'
))
$wp_query
->set(
'post_type'
,
'any'
);
 if
(
$wp_query
->get(
'category_name'
))
$wp_query
->set(
'post_type'
,
'any'
);
}
// tag and category hooks
add_action(
'init'
,
'tags_categories_support_all'
);
add_action(
'pre_get_posts'
,
'tags_categories_support_query'
);
0 notes
yourcodesupport-blog · 6 years ago
Text
WP- How to add multiple authors to a WordPress post
Do you want to credit multiple authors for an article on your website? By default, WordPress posts are assigned to a single author. However, if you often need to credit multiple authors, then there is an easier way to to do this.
You will need to install and activate the Co-Authors Plus plugin.
Now go ahead and edit the post or page where you want to credit multiple authors. On the post edit screen, you will notice the new ‘Authors’ box just below the post editor where you can credit multiple authors.
Tumblr media
0 notes
yourcodesupport-blog · 6 years ago
Text
Save your internet
Quick reminder: Yesterday on the 14th of february 2019 the european parliament decided to accept article 13. Article 13 will force every internet page to use upload filters for the people who live in europe so we can’t see what we want to see anymore.
The last chance to stop article 13 is between march and april where the EU parliament will decide if article 13 will be implimented or not.
On the 23rd of march 2019 everywhere in the europe people will go on the streets and protest against article 13. So I beg you if you have time and are for the free internet try to go to a protest to save your internet.
0 notes
yourcodesupport-blog · 6 years ago
Text
How to Create a Customized Date Button for WordPress
When making your blog stand out, one thing that bloggers often ignore is the date button. Something as simple as a customized date button can really make a difference in your blog’s design. Therefore in this article we will show you how you can create a customized date button for WordPress.
Tumblr media
We will start out from the image shown in the left, and will make it look like the one in the right.
You can use the image that we are using above if you so desire for your use, or create your own one.
First thing you need to do is open your style.css file and add something like below:
.datebg{ background: url(images/datebg.gif) no-repeat; height: 173px; width: 173px; } .day{ } .month{ }
Now you may style it however you like, and you can also change the name of the class. Then you would need to open your index.php and single.php. And add the following code where your template fits.
<div class="datebg"> <div class="month"><?php the_time(’M’) ?></div> <div class="day"><?php the_time(’d’) ?></div> </div>
Make sure you change the styling to fit your needs. Now you should have a customized date image. You can also refer to WordPress Codex for more information.
0 notes
yourcodesupport-blog · 6 years ago
Text
WP-Add Images in WordPress Sidebar
Add Images in WordPress Sidebar
WordPress does not come with an easy way to just upload and display images in your sidebar (though it is expected to change soon in an upcoming version). At the moment if you want to add an image, then you need to add the HTML code for it.
First, you need to upload the image to your WordPress site using the media uploader and copy its URL.
Next, go to Appearance » Widgets page and add a text widget to your sidebar. Inside the text widget you will need to add the HTML in the following format.
<img src="Paste image URL here" alt="Alternate text" />
You can now save your widget settings and preview your website.
For more details see our guide on how to add an image in WordPress sidebar widget.
0 notes
yourcodesupport-blog · 6 years ago
Text
WP- Use Shortcodes inside Text Widgets
Shortcodes allow you to easily add small functions into WordPress posts and pages. However, they do not work in the text widget.
To run shortcodes in your sidebar text widgets, you need to add this code to your theme’s functions.php file or a site-specific plugin.
1
add_filter(
'widget_text'
,
'do_shortcode'
);
You can also use the Shortcode Widget plugin, which adds a shortcode enabled text widget to your WordPress site.
For more information, take a look at our guide on how to add shortcodes in WordPress sidebar widgets.
0 notes
yourcodesupport-blog · 6 years ago
Text
WP- Add Custom Default Gravatar Image
WordPress uses Gravatar to display user profile photos in WordPress. If a user does not have a gravatar, then WordPress uses a default image which is called ‘Mystery Person’.
This default gravatar image will appear many times in your WordPress comments area simply because a lot of users do not have a gravatar image associated with their email address.
You can easily replace this default gravatar with your own custom default gravatar image.
First you will need to upload the image you want to use as your default gravatar image to your WordPress media library.
Next, you need to copy the image file URL.
Tumblr media
Now you need to add the following code to your theme’s functions.php file or a site-specific plugin.
123456
add_filter(
'avatar_defaults'
,
'wpb_new_gravatar'
);
function
wpb_new_gravatar (
$avatar_defaults
) {
$myavatar
=
'http://example.com/wp-content/uploads/2017/01/wpb-default-gravatar.png'
;
$avatar_defaults
[
$myavatar
] =
"Default Gravatar"
;
return
$avatar_defaults
;
}
Don’t forget to replace $myavatar value with the URL of the custom gravatar image you uploaded earlier.
You can now visit Settings » Discussion page, and you will notice your custom default avatar added to default avatar choices.
For detailed instructions check out our tutorial on how to add change the default gravatar in WordPress.
0 notes
yourcodesupport-blog · 6 years ago
Text
Display Excerpt (Post Summary) on Home and Archive Pages
You may have noticed that all popular blogs show article summary instead of full article on their home and archive pages. It makes those pages load faster, increases page views, and avoids duplicate content across your website.
Tumblr media
For more on this topic, see our article on excerpt (summary) vs full posts in WordPress archive pages.
Many premium and free WordPress themes already use excerpts on home and archive pages. However, if your theme doesn’t display excerpts, then see our guide on how to display post excerpts in WordPress themes.
0 notes
yourcodesupport-blog · 6 years ago
Text
Tumblr media
1 note · View note
yourcodesupport-blog · 6 years ago
Text
WP- Important WordPress Charitable Donation Plugins For Charity Websites
67% of donors preferred to donate through online methods, the most preferred medium to donate for the Millennials and the Generation X are online.
Increased usage of mobile payments like Apple pay, android pay has also increased the online fundraising. These WordPress plugins help you to accept online charitable donations and make your fundraising efforts lot simpler and easier.
Best WordPress Donation Plugins
Along with the donation plugins, I will also mention other important WordPress plugins to make your charity website lot more easy to manage and use.
Here are some of the best WordPress donation plugin you can use for your charity website.
Give WP
Tumblr media
Give WP is the famous WordPress donation plugin, you can saw this plugin recommendation in almost all the donation plugin list articles on any website. The reason is the quality of the plugin and easy to use interface, even for the beginners.
This plugin can be integrated with most of the popular payment gateways. It is an all in one donation plugin.
You get the donation forms, clean and detailed reporting of the donations received and you also get the donor management. There are different plugins for each feature, but the plus point of getting all the feature in one plugin is, the seamless integrity and makes your workflow simpler.
It is a free plugin. For advanced features like a recurring donation, PayPal and other gateway integration, PDF receipts, you have to get premium addons.
0 notes
yourcodesupport-blog · 6 years ago
Text
SQL- Tips to resolve “Table error: Object O_ID… page P_ID was not encountered.” Error
sql-server-recovery-blog1:
The records in Microsoft SQL Server database can be placed and located in the form of a B-tree. These records are divided into various pages (child pages), each having a unique index page, which is one level up in hierarchy from the child page. Corruption in the hierarchical tree structure (metadata structure corruption) primarily results in loosing the reference of the child page from the Index page. In such situations, the data stored in the database becomes inaccessible. For accessing the data stored in the database, an ideal way is to restore it from an updated database backup. But if in case of absence of an valid database backup, you will need to use advanced MS SQL Database Recovery application to repair your database. Consider a practical scenario, where you receive the below error message when you attempt to access the records stored in table: “Table error: Object ID O_ID, index ID I_ID. Parent node for page P_ID was not encountered.” The above error message makes the data stored in table inaccessible. Moreover, the error message repeatedly repeats every time you attempt to access the records stored in the table. Cause: The root cause for the occurrence of the above error message is SQL database corruption due to metadata structure damage. Note: SQL database can be corrupted either due to logical or physical factors. Resolution: To resolve the above error message and to access the table records, you will need to follow the below measures:
To solve all the corruption issues caused due to physical damage, swap the corrupt system component with a new component.
To solve  all the corruption issues caused due to logical damage, run DBCC CHECKDB command with correct repair clause.
The first measure is competent enough to resolve all the physical damage issues. The second measure, however, fails to resolve all logical corruption problems. For such situations, the database table can be repaired by using advanced MS SQL Database Repair software. These SQL Server Recovery utilities employ effective scanning methods to completely repair the corrupt table after all logical database corruption scenarios. Resource: http://ezinearticles.com/?Tips-to-Resolve-table-Error—Object-O_id-Page-P_id-Was-Not-Encountered-Error&id=3451876
Source: sql-server-recovery-blog
0 notes
yourcodesupport-blog · 6 years ago
Text
Java-How to delete a Cookie in a JSP?
The following code explain how to delete a Cookie in a JSP :
1234567891011
Cookie mycook =
new
Cookie(
"name1"
,
"value1"
);
response.addCookie(mycook1);
Cookie killmycook =
new
Cookie(
"mycook1"
,
"value1"
);
killmycook . set MaxAge (
0);
killmycook . set Path (
"/"
);
killmycook . addCookie ( killmycook
1
);
0 notes
yourcodesupport-blog · 6 years ago
Text
Do you feel that?
Tumblr media
0 notes
yourcodesupport-blog · 6 years ago
Text
Java- What is the difference between execute, executeQuery, executeUpdate?
What is the difference between execute, executeQuery, executeUpdate?
Statement execute(String query) is used to execute any SQL query and it returns TRUE if the result is an ResultSet such as running Select queries. The output is FALSE when there is no ResultSet object such as running Insert or Update queries. We can use getResultSet() to get the ResultSet and getUpdateCount() method to retrieve the update count.
Statement executeQuery(String query) is used to execute Select queries and returns the ResultSet. ResultSet returned is never null even if there are no records matching the query. When executing select queries we should use executeQuery method so that if someone tries to execute insert/update statement it will throw java.sql.SQLException with message “executeQuery method can not be used for update”.
Statement executeUpdate(String query) is used to execute Insert/Update/Delete (DML) statements or DDL statements that returns nothing. The output is int and equals to the row count for SQL Data Manipulation Language (DML) statements. For DDL statements, the output is 0.
You should use execute() method only when you are not sure about the type of statement else use executeQuery or executeUpdate method.
In case you are facing any challenges with these java interview questions, please comment your problems in the section below. Apart from this Java Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka!
0 notes