Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

AhmadKhan on "same permalink for posts in seperate categories"

$
0
0

Hi,
I wana make some post with same permalinks in seprate categories.
for example:
I have post 1 with P1 permalink in cat1 and have post 2 with P2 permalink in cat2. now I wana change P2 to P1.
at the end:
I want this structure:
localhost/cat1/p1
localhost/cat2/p1
but wordpress automatically add -2 to the changed permalink..

Plz help me...
thx alot...


theultimate1 on "[Plugin: JJ WP Easy Navigation] Looping navigation links across the website"

$
0
0

About the plugin:
A simple navigation plugin which helps users to move backward and forward posts using arrow keys or buttons.

Link to Plugin page

I did some modification to the plugin by adding the is_home condition (in addition to the is_single condition) and got the plugin working on the homepage as well.

I have a feature request though. I've written to the plugin author already, but then I thought maybe someone in this awesome community knows how it can be done too.

So, here goes my request...

It would be great to have both previous and next links on the homepage too. Currently, I see only 'previous' link on the homepage at the left side of the screen. The 'next' link on the right side could actually be a site-wide loop feature taking the user to the first ever post on the blog/site if clicked upon. Similarly, on the first ever post on the blog/site, clicking on the left side 'previous' link would take the user to the latest post on the blog. Can this be done by doing a small tweak in the code? I'd love to have this feature on my website. Please help me here.

WhiteAce on "FrontEnd Grouping by Custom Fields"

$
0
0

Hey there!
just wanted to know if there is a way to group posts by their custom fields?
let's say something like this:
I have a <select> Custom field named "food name" ->
I want to display a frontend page that will display two columns: "vegetables" & "fruits".
so if you select "apple" or "banana" on the post custom field - it need to be injected to the "fruits" column - but if you choose "cucumber" or "broccoli" it will be injected to the "vegetables" column.

Digex on "add an icon to homepage service tab"

$
0
0

I have a theme that i am customizing. I created 4 pages. On the homepage, below the featured slider, is a tabbed content area. Each tab is populated by one of my four pages.
I want to add icons to the top of the tabs. I tried to add a custom class. This worked, but it applies the same icon. I believe, I need to create an array to establish a new class for each tab. How is this done? here is the code that generates the tab array.

<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
						<?php
							$hash = 'service_' . strtolower( preg_replace( '/ /','_', get_the_title() ) );
							$et_nova_settings = maybe_unserialize( get_post_meta( get_the_ID(),'et_nova_settings',true ) );

							$tab_title = isset( $et_nova_settings['et_service_tabtitle'] ) && !empty($et_nova_settings['et_service_tabtitle']) ? $et_nova_settings['et_service_tabtitle'] : get_the_title();
							$tab_subtitle = isset( $et_nova_settings['et_service_tab_subtitle'] ) && !empty($et_nova_settings['et_service_tab_subtitle']) ? $et_nova_settings['et_service_tab_subtitle'] : '';
						?>

						<li class="tw_iconset"><a href="#<?php #echo $hash; ?>"><strong><?php echo esc_html($tab_title); ?></strong><?php if ($tab_subtitle != '') { ?><span><?php echo esc_html($tab_subtitle); ?></span><?php } ?></a></li>

http://ghana.txtunited.com/public_html/
Notice the cloud icon, this is one of the 4 icons, I attached it by adding a class the <li> tag called "tw_iconset" and styled it in style.css.

How do I add the icons to the top of the tabs properly?

slyphidine on "[Plugin: Simple Events Calendar] Changing event sort order"

$
0
0

I saw a few questions about this. I answered it on the original question, but thought it might be hard to find. So here it is:

I was able to change the sort order by adding some code to the php file. Within the simple-events-calendar.php file find the following block:

function eventquery($label,$age,$range,$limit) {
	global $wpdb;
	$table_name = $wpdb->prefix . "simple_events";
	if(!is_null($age) && !is_null($label)) {
		$conditions = "WHERE event_label = '$label' AND $range ORDER BY event_start $limit ";
	} elseif(!is_null($age)) {
		$conditions = "WHERE $range ORDER BY event_start $limit";
	} elseif(!is_null($label)) {
		$currentTime = time();
		$conditions = "WHERE event_label = '$label' AND event_end >= $currentTime ORDER BY event_start $limit ";
	} else {
		$currentTime = time();
		$conditions = "WHERE event_end >= $currentTime ORDER BY event_start $limit ";
	}

In the four places after the $limit" part, add DESC. So the first instance would change from:

$conditions = "WHERE event_label = '$label' AND $range ORDER BY event_start $limit ";

to

$conditions = "WHERE event_label = '$label' AND $range ORDER BY event_start $limit DESC";

The 4 separate lines are for when there are limiters placed in the events tag (such as [events age=expired]. With this, I was able to just place it on the limiter for age. That made my upcoming events in ascending date order, and my past events (the ones that used the age limiter) in descending order.

Hope that helps!

http://wordpress.org/plugins/simple-events-calendar/

Aikyrie on "Using Multiple Taxonomy Query in WP_Query"

$
0
0

I followed the instructions here http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters in regards to using multiple custom taxonomies but my code doesn't seem to be working and I can't figure out why.

I am tagging the page with specific taxonomies so that they'll display a specific page when they are tagged with those taxonomies. For example, if I tag page A with page 1, page 1 will display as a related page.

It's returning the right terms but the query isn't spitting out anything.

Here's my code:

<?php
	global $post;
	$services_terms = get_the_terms( $post->ID, 'related-services' );
	if ( $services_terms && ! is_wp_error( $terms ) ) :
	$services_name = array();
	foreach ( $services_terms as $services_term ) {
		$services_id[] = $services_term->term_taxonomy_id;
	}
	$services = join( ", ", $services_id );
	$related_service = new WP_Query(array(
		'posts_per_page' => '4',
		'post_type' => 'page',
		'tax_query' => array(
			'relation' => 'AND',
			array(
				'taxonomy' => 'related-services',
				'field' => 'id',
				'terms' => array($services)
			),
			array(
				'taxonomy' => 'related-projects',
				'field' => 'id',
				'terms' => '730',
				'operator' => 'NOT IN'
			)
		)
	));
	while($related_service->have_posts()) : $related_service->the_post(); ?>
    	<div id="post-<?php the_ID(); ?>" <?php post_class('serv-block'); ?>>
        	<div class="serv-title-wrap">
            	<div class="serv-title"><a href="<?php the_permalink(); ?>" alt="<?php the_title(); ?>"><?php the_title(); ?></a></div>
				<?php the_post_thumbnail('pro-serv-thumb'); ?>
            </div>
        </div>
    <?php endwhile; endif;
	wp_reset_query(); ?>

Any help would be greatly appreciated. Thank you!

jraven90@aol.com on "Is there any way I can end my URL's in .htm"

$
0
0

I am moving a successful ecommerce site to WordPress, but all my old URLs end in .htm
Since WordPress removes periods from URLs, it doesn't look like I can use these old ones.

Because I don't want to lose any hard earned SEO, I would do anything to avoid having to use redirects to new URL's. Is there any hack that would allow me to have my new WordPress URLs end in .htm?

andrewrowland.g on "Hide Specific Divs from specific user role groups"

$
0
0

What is the most secure way to hide specific divs from everyone besides a specific user role group?


Arshi.Sheikh on "Html Code via Post Method, Escape Problem"

$
0
0

i have created my self coded mailing system and associated with worpress using like we create template page, the problem this that when i post html email to another page it it escape html tags like

<div id=\"wrapper\">&nbsp;</div>
<div id=\"menu\" style=\"background: #858503; height: 50px; width: 600px; margin: 0px auto; padding: 0px auto;\">

how to avoid this because i disappear my style, is there any setting or function unescape POST input or i should replace escape slashes with null value

jdpfresh on "Front end comment sorting"

$
0
0

I'm trying to figure out a way to sort my comments. I'm using the comments rating plugin which adds karma to the comment.

I want viewers to be able to sort the comments from newest to oldest and from highest rated karma to lowest.

I've figured out how to sort them, but I DO NOT know how to create a link or interface that gives viewers the option to select different sort methods.

I tried this method: http://www.jacklmoore.com/notes/jquery-tabs/
- It works in displaying the comments, but the comment form seems to only process on the default tab — this means when I click reply on a comment that is on the 2nd tab, the comment form collapses on the first tab. Is there maybe a way to reload the content so it thinks its a fresh process when clicking between the tabs?

Any other suggestions? I've been researching for hours on end per day and this is stumping me :(

Thanks guys!

queengab on "Create or find plugin form with notification mail and db registration"

$
0
0

Hi to all,

is a sunny day in Rome very hot like my head :)
I contact you for a question.
I have to create a simple registration form with two caratherestics:
senda notification via mail to the users and to administrator
register the data on external db or table to export all datas.

Which plugins can i mix? And how to merge all by code?
I don't find any example after googling but not suitable for my interest.

Thanks very much!
Gabriele

tmeche87 on "Insert variable into URL"

$
0
0

Hey I'm trying to concatenate two variables and use them to within a URL. However, it hasn't been working and I've tried several different methods.
Here is my current code that I am trying to use, but it's not working.

<?php $proj_tit = get_post_meta($post->ID, 'wpcf-project-title', true) ?>
	<?php $proj_title = str_replace(" ", "-", $proj_tit) ?>
	<?php $custurl = "http://www.webdev.blabla.org/projects/" ?>
	<?php echo ('<a href="$custurl . $proj_title">$proj_tit</a>') ?>

$proj_tit is getting the value "Malware Evolution"
$proj_title is getting the value "malware-evolution"
$custurl is getting the value "http://www.webdev.blabla.org/projects/"

I want to concatenate the two variables within the tags but it is not working.

With this code, my URL is this:
http://webdev.blabla.org/projects/$custurl.$proj_title

I want it to look like this:
http://webdev.blabla.org/projects/malware-evolution

I'm not sure why but the link is autmatically getting the "http://webdev.blabla.org/projects" part of the URL from somwhere. It's not getting this from my $custurl variable.

Can anybody please help me? I'm lost as to what I should do.

DanRoller on "Is full control of http response possible?"

$
0
0

I am converting a web application to wordpress.
I need a way to write a page from the plugin with the http header from the plugin values.

Use cases:
(1) Extract a subset of plugin data in csv format into a spreadsheet.
(2) Export a private file (.doc, .xls, .txt, ...) as uploaded back into the native application.

The uploading and extraction code is working but when I try exporting a file,
the wordpress headers and menus have already been written. The ob_end_clean, header, header,
ob_clean, flush,readfile, and die approach deals with the tail end but not the start.

Being new to wordpress,
(1) is there a way to have full control of the http response? Disabling headers?
(2) should I not try to support a common business application on wordpress?

I have seen responses that
(1) have the site mug their template for either a page# or url parameter,
but I think it prohibitly ugly to require sites to manually.
(2) suppose it could also require a theme and try to bind the plugin to it.
I don't know how to do that or if it is possible.
(2) could such an plugin use a "static" page? I haven't figure that out.
(3) indicate that another platform such as Drupal is more appropriate for such activity.

Love to hear your thoughts.

detoner on "adding image to woocommerce archive descriptions"

$
0
0

Hi
Can anybody help - woocommerce has the hook to add the archive descriptions using this function

if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) {

   /**
    * Show an archive description on taxonomy archives
    *
    * @access public
    * @subpackage Archives
    * @return void
    */
   function woocommerce_taxonomy_archive_description() {
      if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) {
         $description = term_description();
         if ( $description ) {
            echo '<div class="term-description">' . wpautop( wptexturize( $description ) ) . '</div>';
         }
      }
   }
}
if ( ! function_exists( 'woocommerce_product_archive_description' ) ) {

but nn allowance for an image - can any body help with that?

The text is currently added via the category description in the woocommerce product categories - is there now a way to make it that html code will display i.e. so we can add the html code of the image in the category description box in the admin area?

or it does allow for a category thumbnail to be added also- can this be adapted to display a larger image?

credo61 on "Add a tinyMCE plugin + WordPress functionality"

$
0
0

Hi,

I've added a button to tinyMCE which loads a php file into the iframe.
Actually it's a shortcode manager and I need to use some wordpress functionality such as translation functions or getting categories list or ...

To do this, I need to include wp-load.php and every thing works great with it. But I read on the forums that including wp-load.php is not a good practice at all!

So what's the best solution for my problem? Is there any way to load tinyMCE plugin without loading it within iframe or is there any other way to use wordpress functions in a file which is loaded into iframes or popups?

Thanks.


RobinBolscher on "normal navigation menu to WP nav menu"

$
0
0

Dear WP'ers,

I am working for someone to move his existing website to the wordpress platform, by making a custom theme of his original website. Now I'd like to make a custom menu of the current navigation so that we can easily add new navigation items through the backend of wordpress.

This works, but not completely. I'd like to use the old style and animation of the menu. It uses ddsmoothmenu (ddsmoothmenu website). It works fine on hardcoded pieces of menu, but when using wp_nav_menu(); to generate the code that goes in to the div of ddsmoothmenu (div id and class), it goes wrong.. The dropdown menu wont drop down anymore on hover over.

I've been stuck here for a couple of days so far, and you are my last hope..
A little help is very much appreciated.

Below the relevant pieces of code.

the website

HTML:

<!-- START HEADER -->
        <div class="header head-pat6">
            <div class="container_12">
                <div class="grid_12">
                    <!-- START HEADING -->
                    <div class="heading">
                        <!-- START LOGO -->
                        <div class="logo">
                        </div>
                        <!-- END LOGO -->
                        <!-- START NAVIGATION -->

                    <div class="navigation">
                     <!--WORDPRESS INTEGRATED MENU BELOW-->
                      <div id="header">
                      		<h1></a><a>"><?php bloginfo('name'); ?></a></h1>
                      		<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'menu_class' => 'nav', 'theme_location' => 'primary-menu' ) ); ?>
                    </div>
                    <!--WORDPRESS INTEGRATED MENU BELOW-->
                    <div id="smoothmenu1" class="ddsmoothmenu">
                           <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'theme_location' => 'primary-menu' ) ); ?>
                    </div>
                    <!-- OLD MENU BELOW -->
                    <div id="smoothmenu1" class="ddsmoothmenu">

<ul>
<li><a href="index.html">Home</a></li>
<li><a href="">Products</a>
<ul>
<li><a href="">Washing & Drying</a></li>
<li><a href="">Waxes & Sealants</a></li>
<li><a href="">Optimum Coatings</a></li>
<li><a href="">Leather, Vinyl & Trim</a></li>
<li><a href="">Tires & Wheels</a></li>
<li><a href="">Polishes</a></li>
<li><a href="">Scratch Shield</a></li>
<li><a href="">FurRemover</a></li>
<li><a href="">Accessories</a></li>
</ul>
</li>
<li><a href="">Dealers</a></li>
<li><a href="">Media</a>
                            </li>
<li><a href="">Contact</a></li>
</ul>
                        <br style="clear: left" />
                    </div>
                    </div>
                    <!-- END NAVIGATION -->
                    </div>
                    <!-- END HEADING -->

CSS-style:

.nav ul{
    list-style:none;
}

.nav li{
    float:left;
    position:relative;
}

.nav a{
    display:block;
    text-decoration:none;
    color:#fff;
    padding:0 15px 10px 0;
    font-size:13px;
    font-weight:bold;
}

.nav ul ul{
    display:none;
    position:absolute;
    top:100%;
    left:0;
    float:left;
    z-index:99999;
    background: #212121;
}

.nav ul ul ul{
    top: 30%;
    left:100%;
    background: #343434;
}

.nav ul ul a{
    height:auto;
    line-height:1em;
    padding:10px;
    width:130px;
}

.nav li:hover > a,.nav ul ul:hover > a{
    color:#ccc;
}

.nav ul li:hover > ul{
    display:block;
}

CSS-ddsmoothmenu:

.ddsmoothmenu{
    font: bold 14px Arial;

}

.ddsmoothmenu ul{
    z-index:100;
    margin: 0;
    padding: 0;
    list-style-type: none;
    float: right;
}

/*Top level list items*/
.ddsmoothmenu ul li{
    position: relative;
    display: inline;
    float: left;
    z-index: 9999 !important;
}

/*Top level menu link items style*/
.ddsmoothmenu ul li a{
    display: block;
    color: white;
    padding: 8px 20px;
    padding-left: 0px;
    color: #2d2b2b;
    text-decoration: none;
    text-transform: uppercase;
}
.ddsmoothmenu ul li:last-child a{
    padding-right: 0px;
}

* html .ddsmoothmenu ul li a{ /*IE6 hack to get sub menu links to behave correctly*/
    display: inline-block;
}

.ddsmoothmenu ul li a:link, .ddsmoothmenu ul li a:visited{
    color: #FFFFFF;
}

.ddsmoothmenu ul li a.selected{ /*CSS class that's dynamically added to the currently active menu items' LI A element*/
    color: #FFFFFF;
}

.ddsmoothmenu ul li a:hover{
    color: #666666;
}

/*1st sub level menu*/
.ddsmoothmenu ul li ul{
    position: absolute;
    left: 0;
    display: none; /*collapse all sub menus to begin with*/
    visibility: hidden;
    background: #FFF;
    -moz-box-shadow: 0px 0px 10px #666;
    -webkit-box-shadow: 0px 0px 10px #666;
    box-shadow: 0px 0px 10px #666;
}

/*Sub level menu list items (undo style from Top level List Items)*/
.ddsmoothmenu ul li ul li{
    display: list-item;
    float: none;
    border-bottom: 1px solid #E9E9E9;
}
.ddsmoothmenu ul li ul li a {
    color: #9F9E9E !important;
}
.ddsmoothmenu ul li ul li a:hover {
    color: #6F6E6E !important;
}
.ddsmoothmenu ul li ul li:last-child {
    border-bottom: none;
}

/*All subsequent sub menu levels vertical offset after 1st level sub menu */
.ddsmoothmenu ul li ul li ul{
    top: 0;
}

/* Sub level menu links style */
.ddsmoothmenu ul li ul li a{
    font: normal 12px Verdana;
    width: 160px; /*width of sub menus*/
    padding: 7px;
    margin: 0;
    border-top-width: 0;
    text-transform: none;
}
.ddsmoothmenu ul li ul li a:hover {
    color: #666;
}
/* Holly Hack for IE \*/
* html .ddsmoothmenu{height: 1%;} /*Holly Hack for IE7 and below*/

/* ######### CSS classes applied to down and right arrow images  ######### */

.downarrowclass{
    position: absolute;
    top: 12px;
    right: 7px;
}

.rightarrowclass{
    position: absolute;
    top: 6px;
    right: 5px;
}

/* ######### CSS for shadow added to sub menus  ######### */

.ddshadow{
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
}

.toplevelshadow{ /*shadow opacity. Doesn't work in IE*/
                 opacity: 0.8;
}

Thanks in advance!

Neo on "How to check if a Textarea is empty in Javascript or Jquery?"

$
0
0

I would check, if possible Ajax, the comment form is empty.
In the case of empty printed below the textarea red to "give me a text."
If successful transmission, the green enter into a textarea, the comment form below to "send successful"
Oh, and do not want to replace any of the current one plugin, as many shell functions linked to the current form.

thermann78 on "Admin users: Count of Custom Post Types"

$
0
0

Hey there,

I'm struggling with a problem I couldn't solve so far by myself, so I hope to get a solution here.

We have a Q&A-Community based on WP. Each new user can post questions that are based on custom post types. New users automatically are subscribers. The answers are based on the regular WP comment system. So far, so good.

Now I try to improve the user administration in the backend. My problem: Wordpress seems to count only regular posts - I don't have a chance to control the questions users are asking. I already managed to include a sortable column with the user's registration date, but with the custom post types I've had no luck so far.

Anybody of you guys or girls has an idea how to solve this problem?

Thank you very much in advance!

Kind regards, Timo

jjruizrivera on "Html editor and security issues"

$
0
0

Hi

I have been asked to enable the html editor in one site where users can enter their posts.Note that no post is published until it is reviewed by us. However I am not sure if enabling the html editor implies any security issue or if I am opening a back door to hackers or if they can inject scripts or something like that.Is it a good idea to enable the html editor for all users?

Thanks

endervikin on "Single Page Analytics for users"

$
0
0

I want to create single page analytics for WordPress Users. I have a good background in Google Analytics but was hoping to save some time by finding someone that has already bridged GA and WordPress in this fashion.

The goal is to provide the WP admin the ability to give users access to the analytics for individual pages of the WP site.

I welcome any feedback.

Viewing all 8245 articles
Browse latest View live




Latest Images